Originally these patches where part of T148626: [Task] EntityIdValues should be formatted as local wiki links in Wikitext output, but got blocked with -1 and removed from the chain of patches I build intentionally, and T148626 got closed without looking back at these patches.
Patches for review: