There's also at least one case[1] where the locked door itself stopped someone from stopping the crash (the CA had flying experience and Mentor Pilot[2] showed that even someone with no flying experience could be instructed to autoland if they know how to use the radio. If the CA had entered earlier they might've been able to land, though most of the passengers would've still died unfortunately.)
One of the more reasonable theories for MH370 is similar to the Germanwings case. Pilots can refuse access even if the person outside knows the access codes for the cockpit doors.
Unfortunately (as with everything else), even obvious improvements have potential downsides.
[1]: https://en.m.wikipedia.org/wiki/Helios_Airways_Flight_522
[2]: https://www.youtube.com/watch?v=YaOvtL6qYpc