HtmlHelper::modifyElements(…, $html5format = false) incorrectly encodes HTML entities.
We added this option in https://gerrit.wikimedia.org/r/c/mediawiki/core/+/979165, used it in https://gerrit.wikimedia.org/r/c/mediawiki/core/+/977814, then found the problem in T353920 and had to revert that patch (https://gerrit.wikimedia.org/r/c/mediawiki/core/+/985033).
We should either resolve the problem (and maybe reinstate the reverted patch), or also revert the patch that added the option, since it can't be used safely.