If there is risk… imposing unnecessary risk
You kinda contradicted yourself there. You clearly think there is a risk. I await evidence that such risk exists in the first place.
Someone’s biological sex is neither fixed nor discretely binary, so we are once again at a loss as to what the fuck you mean when you say “male” and “female.” Or are you conservative perverts the ones peeking over stalls to see what plumbing your neighbour has?
Seriously. The only intelligent solution here is to fuck off and stop worrying about it. There are already laws against sexual assault. Start prosecuting them effectively. There’s your god damn solution.