When I write a normal level-2 header in wikitext with the text "x :", and then inspect the content of the resulting HTML element, I find that its textContent is "x", then a nbsp, then a ":". This is unexpected: I would normally think a normal space in the wikitext would result in a normal space in the HTML.
Possible explanation proposed by Brion on Mastodon, from https://mastodon.technology/@brion/100575141289871028: "there's some nbsp replacement around certain punctuation to handle patterns common in French"
There is a function in MediaWiki called armorFrenchSpaces which does this. It's clearly intended behaviour, and I would even argue that it is correct behaviour for all languages (other than programming languages, perhaps). See https://phabricator.wikimedia.org/source/mediawiki/browse/master/includes/parser/Sanitizer.php$1146