Manual:$wgAlwaysUseTidy/en

Details
In some internal places in MediaWiki (mainly when generating parts of the interface), HTML Tidy is not used by default, even when is turned on. If you want to override this, and always use HTML Tidy for every bit of wikitext parsing, you can set this option to true.

It is unclear why you would want to do this; your server performance will most likely suffer. However, if MediaWiki is continuing to generate incorrect HTML even when $wgUseTidy is turned on, it is worth trying this as a "quick fix" until the underlying issue can be located and resolved.