As a PP stated, we use peer enforcement (the "competent guardian" of criminology) to keep males out of the loos.
In fact, not even that: there are two cheese layers before we get to "competent guardians" being in the same space as rapists and targets and preventing rapes by being there.
First cheese layer: we use peer enforcement of single-sex spaces to keep the offender (male, rape weapon person) from getting near the target (female, unpatchable security vulnerability person), enabling women and girls to visit the loo alone. The 94% of men who do not use their penises to rape are also part of that peer enforcement, by challenging a man attempting to enter the ladies as he makes the attempt, or summoning the police/attendant if a man persists in trying to enter the ladies even when challenged.
Second cheese layer: we use the social norm that males use the men's loos and females use the women's loos to filter non-rapist men from risky men, because non-rapist men aren't going to use the women's loo intentionally and, if they do by mistake, they will leave when challenged. Hence, a male in the women's loos has already red-flagged himself as a threat, just by being there, and women in the area can take informed action (e.g. leave, go in in groups for safety, call the police, etc). If social norms change (e.g. multiple occupancy mixed toilets become widespread or males become more tolerated in the ladies loos), we won't be able to rely on a male's presence in the ladies as a red-flagging criteria. We'll have to either take a greater risk of rape or not pee, and no one can hold it in forever.
The "competent guardian" third cheese layer only kicks in if/when a rapist is already inside the loo, the presence of multiple women in the loo acts as a deterrent to rape. This is the last cheese layer, and two cheese layers failed if you had to rely on this one for safety.
Bearing in mind how few rape cases make it to court "you can report your rape, that will deter a rapist" is not a cheese layer. If the three cheese layers fail and a female is raped, a police report is incident post-mortem, not prevention. The aim here is prevention.
The GRA changes, which take away females' ability to challenge men by taking away our ability to presume legal entitlement to enter female space based on visual assessment of biological sex, remove the second cheese layer completely and fill the first with so many holes that it's near-useless, forcing us to rely on the third cheese layer, and if you are the only woman in the loo, you don't even have that any more. This puts any female who wants to go anywhere on her own or with only male company (e.g. husband) on a bladder leash, and that's not on.
I was in Germany once and some fool town planner had put a bench right outside a women's loo. Two guys were sitting on that bench and verbally sexually harassing every woman who used the loo. It was very intimidating. They were deterred from entering only because bystanders can stop them or call the police. Imagine if they could self-id as women... And men will, oh they will: if they will choose jobs (John Worboys, Ian Huntley) to get access to victims and risk their wages and liberty to abuse, if they will risk HIV and hepatitis B to shove used tampons up their arses for sexual thrills, if they will break into houses to wear teen girls knickers to wank and film it (which was useful evidence in the trial), they will fill in GRC forms.