In hindsight a policy of always having at least two people does seem preferable. (And, just a little reminder here: Just because someone is willing to fly a plane with 149 other people on board into a mountain doesn’t mean they would be willing to do other awful things, too, like acting violently in person against another person, for example a flight attendant. Preventing this kind of behavior may well be about putting in place many small hurdles.)
I think it’s pretty clear that people in the cabin should never be able to access the cockpit against the express will of people inside the cockpit (preventing scenarios in which someone violently forces someone with knowledge of how to access the cockpit – e.g. a pilot coming back from the toilet – to divulge that information and gaining access that way), so realistically you can only throw people at this problem – and throwing people at this problem is thankfully in this case relatively straightforward and shouldn’t really have any other negative consequences. I don’t see a technical solution to this problem, but there might not have to be one.