PHP's DOMDocument#createElement is broken: it always sets the namespaceURI of the created element to null. Unfortunately, this makes the createdElement different from all the other elements created by a Remex document parse, which have namespaceURI (correctly and spec-compliantly) to http://www.w3.org/1999/xhtml.
See T215000#5003044 for full details.
We should eventually use a spec-compliant DOM implementation (T215000, T217867). In the meantime, it would be helpful if Remex exposed an option to *not* set the namespaceURI on its created documents, so that parsed elements and constructed elements would be consistent. (Inconsistent namespaces break XPath queries, for example.)