Apple: "It's not our fault that tax loophole was just sitting there, ripe for the taking!"
The rest of the loving world: "It's your fault you abused it, starfish"
It wasn't a loophole. It was a deal that Ireland made with them. Ireland literally told them that if they created jobs in Ireland, they wouldn't have to pay taxes. They agreed to that deal, and then later they were told that since the deal was illegal, they actually have to pay it anyway.
Think of it like this:
You receive mail from the local government of your Canadian province (or for people in the US, state) offering you a deal where if you volunteer for local community service for 4 hours a week, they will waive your obligation for income tax paid to your province (or state). The note explains that they are trying to increase the amount of community service done, and they believe that it is worth trading your direct help in exchange for you having to not pay income tax to them. You gladly oblige, because even though you'll have to spend half your Saturdays at the local soup kitchen, you'll save a bunch of money. Win for you, win for them. Then the Canadian (or US) government steps in and says that that deal is illegal. They state that you can't give unfair tax advantage to someone just for using their time to volunteer. Their ruling demands that you pay back taxes for all of the income you didn't pay tax on while you were engaged in the deal.
Doesn't that seem unfair? Irrelevant of how much money it is, it seems unfair to me to just nix a deal like that. Again, it would be one thing if they determined that it was illegal and going forward the deal cannot continue, but it doesn't seem right to me that they would force you to pay taxes on all that money.