Fix for XQuery Update/XUpdate performance issues

A first round of fixes to improve performance of node-level updates. The time to reindex a document fragment became a major bottleneck with the new range index, because

1. the code was trying to remove outdated nodes from the index more than once
2. insert operations triggered unnecessary reindex runs
3. update expressions were not optimized by query optimizer