Inspired by work on T95985.
Currently, navigation links get added to a page even if they point back to the exact same URL (for example, if you're editing a page, the edit tab is still a link to the page you're already on). That's not ideal, since it can confuse users by giving them a useless link that destroys their state (e.g. scroll position on the page, selections on the history page) without actually taking them anywhere. Reloading can be a valid use case, but browsers already take care of it.
We should change this so that any navigation links which point back to the exact URL of the current page are disabled and unclickable. This leaves out at least one case of self links (for example, if you're on /w/index.php?title=Main_Page, the "read" tab will still link to /wiki/Main_Page even though they're logically the same page), but it's better to leave a few useless links than to accidentally remove a few useful ones.
I've written a patch for this, and I'll now work on uploading it to Gerrit.