This wouldn't have prevented the incident.
Well, presumably you'd make it so that if the second door is closed, the cabin door can't be locked.
Whether Airbus envelope protection is sufficiently robust that there would be no way to break the plane whilst the other pilot is in the toilet, I don't know.