So the EU can just come down and tell it's member countries who they are and aren't allowed to give tax breaks to
Yes, and that's one of the fundamental necessities for a free trade zone.
It's quite easy, Ireland can make as many tax breaks as they want for Apple as long as they are out of EU. If they want to be in EU and trade in the EU open market, then they must be subject to some basic rules.
Also, Apple has to pay these taxes, because they had profit and they failed to pay their respective taxes for more than 1 decade. They aren't going bankrupt by paying taxes over their profits like you are saying.