your right on with this sentiment the utmost first line of defense is being aware, most criminals are very cowardly, meaning if your looking at them or notice them they probably wont make you a target. 30 years working a prison i have seen very well trained officers get taken, why because they weren't aware of who was around them. Watch everyone around you all the time, see what they are doing and why they are there before they get close enough to do you harm. i still do it out of habit having carried a toolbox into cell blocks alone for many years, no one gets behind me without me turning and looking right at them. If someone seems suspicious look directly at them so they know you see them and above all believe the hairs on your neck.
As for the door situation open it but dont go out until you look around and get your eyes focused and be prepared to shut it fast, criminals depend on those doors locking behind an unaware person after they shut then that person has lost thier escape if it feels weird don't go out, shut it.
I'm done now lol. except for this if your standing in a line of ten people anywhere in this country two at least will have felony records some places many more.