If you are in a secure area, like a server room for example, it's perfectly normal for there to be badged entry, cameras everywhere etc. There will also be signs everywhere telling you this.
If it's really secure there will be monitoring of all entrances, including corridors. (And there will still occasionally be people successfully tailgating, usually for perfectly innocent reasons like forgetting their badges at their desks etc. Real security is all sorts of fun.)
In fire/hazard conditions, security systems are required (at least in Australia) to permit free handle egress from any point in the building to a fire escape.
Any access control system has the capability to integrate with a fire system and allow this.
I believe the general policy in the States is "one swift motion" to exit a room which is why you see mostly crashbars and lever handles as egress, mostly on push doors for the primary egress path.
In secured areas where they want you to swipe out or places where they might get tripped accidentally, they sometimes have like a 15 second lockout before actually tripping the door.
I've been in just one server room and they just had a motion-deactivated maglock tied to an electric strike so in the case of a power outage a simple mechanical lock could be opened but otherwise you need to badge in/out.
Some facilities get exceptions to fire policy and require employees to go through training of sorts. Diablo Canyon Nuclear Power Plant is one place I visited that did not have emergency egress. No badge? Call the guards, that is the only way out.
Fire hazard and false imprisonment. Ask walmart. You accidentally lock someone in the store and you are looking at a civil rights law suit. You cannot restrict another humans' movement without due process.
Never been to a Walmart specifically, but every store around here broadcasts a "closing the store in X minutes, please be outside of building by then" message on the loudspeakers a bunch of times, then the employees pack some things up and walk through the entire shop to check if everything is ok and the security personnel, being the last to leave, check all cameras before finally locking up.
This seems like plenty of due diligence for the store not to be liable is someone gets locked inside.
Obviously not the same type of facility, but I have seen buildings where the closing of smoke shutters opens otherwise locked doors, revealing an alternate fire escape from the corridor to the stairwell.
If it's really secure there will be monitoring of all entrances, including corridors. (And there will still occasionally be people successfully tailgating, usually for perfectly innocent reasons like forgetting their badges at their desks etc. Real security is all sorts of fun.)