includes/Conversion/Utils.php does several HTML transformations. It makes these using DOMDocument and uses saveXML and/or saveHTML.
Both of these have problems with preserving the HTML document correctly. See also: T217766 and T252038
Probably these issues should be worked around by making use of RemexHtml or another replacement for the document transformations, like Core's HtmlFormatter.