That depends heavily on whether Apple received clarifications and information about the existing tax code, or whether they received special-case tax breaks that didn't apply to everyone. The latter might violate EU requirements.
Yes, indeed, the legality of something depends on the facts on that something. As the first paragraph notes, the European Commission deemed it illegal state-aid, or a special-case tax break.