Disentangle low level utility methods

This is a big pile of cleanup and simplification in the Razor code, based on the things that I found confusing, or that turned out to be unused when I went digging through the code to understand how they were used.

There is no external behavioural difference between Razor before and after this set of changes - this is purely simplification, or clarification, or elimination of dead code.

It also focuses on reducing the use of apparently mutable state, with a view to making it easier to understand how some of the internal components work and, especially, the ownership / lifecycle of data in the model.