If you’re worried about burglars, invest in locks.
Once the burglar is in your house, you are at a strong disadvantage — there’s a good chance that the burglar will grab that gun out of your hand and if you’re lucky you’ll get away with being pistol whipped before he steals your weapon
Also, I’m betting you live in a high crime area, so for you dealing with burglars is a fantasy.
I live in a high crime big city — I’ve literally seen burglars trying to break into nearby residences.
The way we deal with that around here is to have bars on our windows that can only be opened from the inside, hollow metal doors with multiple locks and if we see a crime in progress we call the police.
As for your fire extinguisher analogy, it’s an apt one — if there’s a fire in your house and you try and put it out yourself, YOUR HOUSE WILL BURN DOWN and you might end up in the burn ward.
Call the fire department and let the professionals handle it