The school's approach is silly, but how many kids need to leave class more than fifteen times a month for bathroom breaks? I don't recall ever having to leave class.
When I was in school, if you said you needed to go to the bathroom, the teacher let you go. I never asked unless it was a real request.
However, if you got caught going somewhere else the teacher didn't trust you in the future.