But nobody wants to see a big explicit carve out like that because of the obvious unfairness (it's a huge advantage to multinationals over smaller companies), so they try to make it less obvious.
The best way to prevent this is to use taxes that can't be avoided through transfer pricing, e.g. VAT. The company can move their headquarters wherever they like; the tax is paid to the jurisdiction where their customers are.
But the other dirty little secret is that this would have to be government revenue neutral (just an increase in fairness), because if it actually increased the amount of taxes being paid on net then consumer prices would go up or retirement accounts would go down or both, because the money has to come from somewhere. So doing the thing that increases fairness has to be done without help from the people who want government to spend more money or you'll be impacting ordinary people who won't like it.
I'm not saying it's nice / fair, but this is reality. It's similar to putting a buffer overflow bug in a C/C++ code on purpuse, but hiding it in a nice function.