How top fix the «Invalid method Magento\Customer\Block\Account\Navigation::removeLinkByUrl» bug

To fix the issue remove the following code line:

The removeLinkByUrl method is absent in Magento 2.
It exists in Magento 1.x, and Magento 2 team mistakenly left it the Magento 2 code while ported the code from Magento 1.x to Magento 2.

Looks like the bug is reproduced only in the situations when the «Magento_Customer» module is processed by system before the «Magento_Theme» module.
These modules do not set a processing ordering relative each other, so the bug appears in random cases, when you installed some third-party module which uses some <sequence> rules.

Another effect of the same Magento 2 core bug is: Bug: the order's title is shown at the bottom of a customer account's order page (and my fix)

It is fixed in the core a week ago:
https://github.com/magento/magento2/commit/177940da2f7ba937cf3daafb190f47d0d7fd451a#diff-056c5a7b5c3385166038ada5b9f6d6e6