This is due to the Parser::parse() function being called. In MediaWiki v. 1.30 the default is to append a <div class="mw-parser-output"> ... </div> whenever it's done.
A workaround (that appears to work, but I have no idea if there are side effects, so there's no guarantees) is to edit the file at includes/parser/ParserOptions.php to always set 'wrapclass' to false. There are two places to do so. At approximately line 790 and line 1060. I would suggest copying the line and commenting it out (by preceding the line with //) just in case it needs to be reverted.