Toilets opening into the corridor is a thing at secondary though, I think, to prevent bullying/Shilly-shallying.
And my child will not be (and does not) going to those schools.
I worked in a school which had a new building constructed. The pupils were consulted on what they would like and almost without exception this is what they requested - toilets directly opening onto the corridor with floor to ceiling doors and sanitary bins within the cubicle. The washbasins were a sort of trough affair opposite the cubicles and could be easily monitored at break times by a member of staff on duty - of course this wouldn't be the case during lessons.
The OP accepts that it works for bullying and other problems - but probably not during lesson times.
They can’t be meeting to do the television sex drugs fighting in the toilets here because they are open block. Gross- but stops any of those shenanigans.
As for this:
It’s not particular students. If it was that would be a more sensible and measured approach
And also unfair and would lead to loads of complaints from parents of these "particular" students who either won't accept that their child has form for this sort of behaviour or who say it's a case of giving a dog a bad name.
When you are an ordinary reasonable parent with ordinary reasonable kids - it seems reasonable to let them go to the toilet when they need it. However, some kids and parents are not reasonable and it is infuriating when you have to re-start your lesson or re-explain things multiple times because several (unreasonable?) kids have earnestly assured you that they are desperate/on their period/have a bladder infection etc. And if you let one go because you think they are genuine but not others because you don't, you are then subject to a barrage of whining and refusal to work as well as parental complaints afterwards.
Also, the reasonable parents and kids are likely to complain because not enough progress is being made in class.
So basically, you're fucked whatever you do - in some schools anyway. Well actually in an alarming number of schools.