Oh my goodness, I am so sorry you, and your son had to endure this. The system is archaic and needs a complete overhaul, especially in primary schools. My dcs' school doesn't even give leeway when they're building immunity at a young age, and were really demanding after covid when they first went back; with high fevers etc; the school woupd send kids home like this!. A condescending letter was sent to all parents. Yes it is important to be punctual, but not at the detriment of wellbeing.
There are genuine circumstances where dcs have to be off, and do not need their health put at risk with unnecessary pressure. My dc is ND, and gets very stressed with attendance certificates. Dc is very literal and tries hard with everything. To dc, it causes a, "Why do I not have a certificate, when I have not been off much." There are dcs who are upset because they haven't been off for nothing, or some have parents that can't be arsed to get out of bed to take them, others have parents who will keep them off if siblings unwell etc. It is out of their control, how fortunate for the able and healthy to get a certificate (because they happened to not catch anything bad enough to stay off).
This year one of my dcs got a certificate for one of the terms at the end of year celebration. They present then infront of all of the parents. 🙄 I feel really uncomfortable with all of the parents clapping after each certificate.
I explained to my child that it wasn't an achievement, but more of a, "you're fortunate you've had good health award."
I hope your son is doing better.