This isn't specific to Apple or Ireland (or even taxes) fwiw. Ordering the company to pay back the subsidy is a normal part of the remedy for subsidies found to violate EU anti-subsidy regulations. The intent is to make it ineffective for a country to pay out subsidies, because they will in the end not have the intended effect, as the company won't get to keep the money. If the remedy were a fine levied on the subsidizing state, but without required repayment, illegal subsidies would have their intended effect of actually subsidizing the target firm (they'd just become more expensive, because the fine would become part of the cost of the subsidy).
For example, when Real Madrid was found to have been unlawfully subsidized by a local Spanish government earlier this year (they were given €18.4m as compensation for a land transfer that fell through), they were ordered to repay the €18.4m [1].
Ireland is the one (accused to be) violating treaties it signed, with the goal of getting an advantage over other signatories, so it is not unlogical that it could be fined in some way for doing so.
Well in that case, shouldn't it actually be Ireland that got fined instead of retroactively taxing Apple?