Meanwhile the companies would then have the incentive to take countermeasures, e.g. make it so the EU entity has no assets and would then have no money to pay retroactive taxes and file for bankruptcy if they get rug pulled like this again, or just pull out of the EU and sell there through third party distributors that have razor thin local margins.
Retroactive court decisions like this set up perverse incentives.
Probably not, if they haven't already; this relates to Apple's tax structure between 1980 and 2014 (ie not currently), and the key issue is that Apple was given unlawful state aid; Apple was advantaged over other companies, and Ireland was advantaged over other member states, which the EU restricts (interestingly, AIUI this would likely have been legal in the US, where states are generally allowed give special tax benefits to specific companies).
Some companies might leave but they are not better off elsewhere in the EU so I think most will stay.