I'm not seeing how the presence of another crew member prevents this scenario. Let's be realistic, if the pilot leaves the cockpit, and the FO has nefarious intentions (or vice versa), the extra crew member is very likely to be a female flight attendant. Not much of a deterrent against someone intent on doing harm.