In the UK, AFAIK, there is no law preventing a man using a woman's toilet or vice versa.
We only maintain these rules because of social niceties, habit, manners, custom, etc etc
So in theory, hardly ideal I know, and in the case of toilets only, a woman could take an older boy into the male toilets.
I generally wait outside and often have opened the door to look in and check on my DS.
Also, dynamic risk assessment about place
I talk to my son about what's right and wrong, the pants rule, to trust instincts, we ask "what would you do in this situation?" questions and he learns a martial art.
He only ever uses a cubicle.
Nowadays he probably has his phone with him too 🤢 but if he needed help, he could use that.