I can give you two first hand instances. DS1s school, very poorly lead, the HT was utterly useless, she locked all the toilets due to perpetual flooding due to little shits shoving paper towels in the toilets, leaving taps running and EVERYONE had to go to her office for the key - we are talking a co-ed sec school of 1600 pupils circa 2006.
Second instance, DS3s school, refusal of a male pupil Y8 to go to the toilet, he dropped his pants and shat on the ICT suite floor, in Y10 the same pupil urinated in the school hall for a similar reason.
Unless you've worked in a school, or similar, and understand that not everyone is toilet trained, not everyone is house trained, some people have very different toilet habits and boundaries, some people are plain disruptive you wont understand why it is expected that the need to go to the toilet is as far as possible confined to lesson breaks, so roughly every 50-60 minutes.
Anyone who cannot manage for that length of time is quite likely to have a medical issue. BUT there are plenty of those parents who would write notes demanding Jaiden-Kai or Tiphney-Mae be allowed to leave lessons and corridor haunt have a lav break as and when they feel the need.
So, you have the few who spoil it for those in need. Obviously leaving lessons on a whim has been an issue and the school has had to clamp down in, what is, a ridiculously bureaucratic way.