> Do the same for all countries.
So here's the specific reason why this is difficult in the case under discussion:
The EU runs as a "single market". It is intended to function such that you do business "in the EU" rather than "individually in every country that is part of the EU". There are no tariffs on moving goods between countries in the EU. Having imported something into the EU, you don't then have to pay more tax to sell it in a different EU country.
Except... the tax rates are not fixed across all EU countries. That was a bridge too far for the politicians when this was being set up. So under the rules as written, it's entirely legitimate - and intentional - to pick which EU country you want to operate in and pay your taxes there. This worked fine until some EU countries realised that they could compete against the other ones to offer more favourable tax regimes and attract businesses to themselves.
This isn't really a fight between companies and governments. The companies are the ball being played. This is a fight between governments over who gets to collect how much of the tax (to call it Germany versus Ireland would be unfair but not entirely imprecise). I do not see a way for it to be settled other than agreeing on tax rates being set by the EU, but that is politically challenging at the moment.
> Tim Cook and Apple have an opportunity and moral responsibility to help close these tax loopholes
I strongly disagree. I do not think that US corporations should be trying to settle arguments between EU governments. That is a level of political involvement which seems grossly inappropriate.