@PortVale
This wouldn't have prevented the incident. Cockpit door would still possibly be closed after Captain/FO exit to go to the lavatory. Even if it wasn't, when the Pilot goes to the lavatory the other could get up and close it.
The point is to allow access to the loo without the cockpit door being locked, so the locking mechanism for the cockpit door would have to be automatically disabled as soon as the crew member opened it.