This is just a 'curious' question. (I'm a retired teacher and a parent.)
I was at a venue recently in the UK- a botanic garden.
There are two lots of loos, male and female. Outside, very airy, open doorway etc at the entrance
I was in the Ladies and a class of kids turned up with their teacher. They looked about Yr 1/2 and possibly a private school as there were only around 12 of them. The boys were using the men's loos.
Their teacher came into the loos to check if anyone was there (I was in a cubicle) and told the children to wait outside until the 'adult' came out. Thankfully I wasn't going to be long!
As I came out she also 'directed' a pair of elderly couples to the accessible loo alongside asking if they'd mind using that one. (Maybe that was just to speed up the pupils' queue.)
I wondered if it was a safeguarding issue that they weren't allowed to use the loos when there was someone else in there.