I read this a few times to try and understand your point.The 12.5K is gross, it hasn't had the PRSI and USC of 1.5K deducted yet, nor the 5k in tax.
After those 3 deductions you're left with 6k and my assumption was that it was this 6k that would attract the relief.
Grossing 6k back up from a 40% deduction only gets you to 10K though
I think the issue might be that USC/PRSI and income tax are applied fully and separately. So, using the figures in your example, you pay €1500 PRSI/USC on the full 12.5k and then you also pay 5k income tax on the full 12.5k. If you contribute the full 12.5k to your pension, you will get the full 5k back, and that would cost you 7.5k nett. But you are not doing that - you are only contributing 6k nett because this is what you have cleared from the original 12.5k because of the additional deductions of PRSI and USC.
So, if you consider a contribution of 12.5k at a nett cost of 7.5k (i.e. 5k tax back), the figures work out.
Likewise, if you consider a contribution of 10k at a nett cost of 6k (i.e. 4k tax back) , the figures also work out.
But is not correct to start with a nett cost of 6k and then wonder why you are only getting 4k tax back and not 5k.
You just can't deduct income tax, PRSI and USC and the hope to get back to the same gross figure when only the first of these is relieved.