Maybe they should have an onboard security checkpoint near the washrooms. It's annoying if you have to go through secondary just to go to the bathroom, but--well--it's all in the name of security.
I think it would then be appropriate to have another checkpoint required to re-enter the cabin.
If anything, the checkpoint will serve as a deterrent to those who might consider standing up, walking, or using the bathroom on a commercial flight.