[BUGFIX beta] Refactor buffer to be simpler, single parsing code-path

The element hook on buffer is a mess. This refactors it so we can actually understand what is happening.

I believe it may catch some edges cases of where contextual element was incorrect as well. :-/

Extraced from #9358