This also leads some teachers and administrators to act like guards or the warden. As a kid, I remember learning at a young age not to drink too much of anything (water or milk) during the school day. When we started school, my parents told my brothers and me that if we had to use the restroom and the teacher wouldn’t give permission, we should just walk out and call them to deal with any disciplinary actions or consequences.
We had hall monitors, and being caught in the hall without a pass meant being written up. So most students would go before gym and during lunch (when there was less monitoring), or just wait until they got home. Forcing children into scenarios like that can cause health problems, but too many in positions of authority care more about control and order than they do about the kids.