I have literally never seen any child over the age of two playing with him- or herself, and I am a retired teacher.
If I had, I would have remarked calmly that one does not do that in public.
I have told teenaghers not to clean their nails in the classroom!
Certainly, never a grown man doing so in public.
Checking their flies, yes, quite a lot of decent men and boys are haunted by the fear that they might just have forgotten to do up their flies, or that their zip may have developed the devastating habit of decending. This disaster occured for my husband once when we were on a trekking holiday and he only had one pair of trousers with him. He solved the problem by a small loop of string through the top of the zip then wound round the button in his waistband.
As he said at the time, "now I really must go to the toilet in good time!"