Separate data/metadata split and node tree loops

It's not much of an optimisation to combine these loops but
separating them gives us greater flexibility.

Move the building of the node tree to happen lazily when
getDocumentNode is called.

In the rich paste path we can now create the DM without building
the node tree and remove the metadata.

Change-Id: I10b4bc486ff8ff8037158aa6dfd45aac87557d42
Merge "Separate data/metadata split and node tree loops"