Locked doors tend to be a deterrent. In fact locked doors have prevented more crimes than guns ever have. The majority of burglaries are committed because of opportunity most often caused by a door not being locked. Those criminals passed up dozens of locked doors before they found an open one.
If someone is on a rampage hoping to shoot as many people as possible, why would he stop to break through a locked door if there is an open door somewhere else? The problem is that when the only tool you have is a gun, you think every instance requires you brandish that gun. In reality there are multiple responses to situations and many of them are more effective than a gun depending on the circumstances.
So, how many times have you hidden behind a locked door and felt morally superior when your life was in danger?
My life has never been in danger when I have been behind a locked door. Perhaps you don't understand the concept of a locked door and being behind it. If someone were to break through that locked door then I would no longer be behind a locked door so your question makes no sense at all.
Given your overall attitude of disdain for my view point on this, I strongly suspect that an attacking chihuahua was the worst threat you ever faced.
Since your only response is a gun, I suspect you have never had to actually use your intelligence in any situation. I'm sure shooting an attacking chihuahua is your only response whereas I can think of a dozen different responses that would require no gun.