Many airlines have reinforced cockpit doors since 9/11. Perhaps some quickly accessible equipment (locked, with key possessed by trusted crew) capable of breaching such armored doors should be available.
I've got an easier and cheaper solution. Make the pilots wear Depends Diapers. No more bathroom visits until the plane lands.