aka "this is why we can't have nice things", juvenile edition :)
Stopping making a big deal out of it will remove the disruption factor. If you can just get up and leave and nobody pays attention the act will quickly lose its effect.
> to get out of class
This suggests there's a bigger problem there if people are so desperate to get out as to fake a bathroom break, but anyway, why not let them? What's the harm? If these people are bored/disgruntled/etc then you already lost the game and no amount of force or coercion will change their mind.
I have literally ZERO sympathy for any teacher who has shitty (haha) bathroom policies.
This is why we can't have streets... ?!?
Jokes aside, you just provided a very good example of the prison mindset:
Instead of trying to understand the "problem" of students going too often to the bathroom, the default choice is to make the behavior prohibited.