A locked out pilot has a memorized code to get back in the cockpit, but it takes a minute or so to override, thus giving pilot(s) inside time to barricade the door in case of terrorism. Bathrooms inside cockpit would be great, but purchasing or remodeling an entire fleet of airliners would skyrocket costs. USA must have two personnel inside cockpit at any time, but not all governments have same rules (Germany). This still doesn't prevent one pilot from overpowering another via deadly force.
Remote flying of planes is already being researched and investigated. However, what happens when a remote pilot goes off the reservation? Or the computer system gets hacked? Who has oversight/authority over foreign inbound/outbound flights?