Do you live in Perth by any chance, OP? I bet it's because of the iron in Perth's water reacting with one of the sunscreen ingredients (avobenzone or butyl methoxydibenzoylmethane). The solution is to look for a sunscreen that doesn't contain avobenzone. The problem is that means you're stuck with the titanium dioxide/zinc oxide products, which tend to be harder to put on and wash off skin.
I have never had success removing the stains

But why do schools choose white for a primary school uniform?? If it wasn't the sunscreen, it would have been paint or fruit or something else.