Illegal, yes, if the EU can prove that either Apple or Ireland broke Union laws that were already clearly set in stone, then they should be punished. Or at least made to pay back what they owed.
But think for a moment. If what Apple and hundreds of other corporations did in Ireland was so clearly illegal, then why the hell did they get away with it for so long? And why was no one (in the EU) able to enforce it years ago?
Something tells me that: the EU is also partly to blame. How? Because the laws were poorly written, and therefore allowed vague interpretation. And in practice, everyone will take the path of least resistance.
This will be an interesting case to watch, actually. As IMHO the onus is on the European Union lawyers to prove that there were clearly established laws which already outlawed the things which Ireland and Apple did. They literally have to pore through the existing tax laws/codes of the EU, and then point out in court "It says right here! Right here, exactly right in this paragraph, this proves to the letter of the law, without a doubt, that what Ireland/Apple did were in violation of the laws of the Union!"