Feature summary:
[[Foo|]] with a pipe saves as [[Foo|Foo]] if there is nothing for the pipe trick to change in "Foo". I suggest it removes the pipe instead and just saves as [[Foo]].
Use case(s):
I became aware of the issue after seeing a confused poster at https://en.wikipedia.org/w/index.php?title=Wikipedia:Village_pump_(technical)&oldid=1302589065#Changes_not_being_saved. They changed [[Foo|Foo]] to [[Foo|]], got a null edit and thought the edit could not be saved.
Benefits:
The current behaviour can confuse as the above shows, and [[Foo|Foo]] is poor code which causes wasted time for editors to examine, especially for longer names where it's not obvious that the display text is identical to the target.