In particular finding out where those funky <head/> and <body/> strings come from is my main focus at present.
I would suggest that is a waste of time. Itís almost certainly indicative of the lack of head and body content. Those are merely how tags/elements/nodes without content are rendered. They are exactly equivalent to this style <head></head>. The problem lies elsewhere.