Without writing a book on the Art & Practice Of Home Defense, I'll just add that most people never actually work a building with a shotgun or carbine & have no idea of the dynamics involved.
Both are relatively heavy & don't swing as fast as a handgun.
This can be an issue in reacting to sudden activity at angles other than straight ahead.
Both are harder to use one-handed.
You may not realize it, but the off hand IS occasionally needed for other things, like opening doors (room & closet), moving things out of the way, working a light independently of the gun, picking up items & people, etc. Along with the possibility of an injured hand.
And that's just "working the space" as you go along.
Both are typically harder to fire well one-handed, too.
Both can be more vulnerable to a grab.
Entering rooms, leaving rooms, handling tight corners, can all involve sticking the barrel out farther than a handgun, most especially if you don't know how to do it right, and most people don't.
This can be aggravated by longer barrel lengths.
Even if you do know how to do it right, it's still not as efficient as a handgun worked correctly.
I tried clearing houses with both a 16-inch AR & an 18-inch 870 years ago, and years ago, after noticing how awkward & clumsy they both were in that role, I left both behind in the company car for indoor activities.
The Safe Room is a great concept.
Calling the cops is a great concept.
But, neither is universally practical in all situations.
If I hear an odd "outa-place" sound at 2AM, or our "watchcat" growls at the bedroom window from her night-time position next to us (which she has been known to do late at night when we're going to bed), it's hardly realistic to barricade ourselves in a safe room & call for deputies to respond from miles away on what might just be a coyote in the back yard.
There are times like that where I'll check out the house myself.
At such times, it's a handgun, because that's what works best for me.
If I hear glass breaking or a door being kicked in, sure- dig in & call for LE, if practical.
If not, handle it.
Everybody makes their own choices, mine are based on VERY extensive experience in working through buildings ranging from large warehouses to small homes.
I know how to take doors, I know how to take corners, I know how to maximize retention & minimize take-away risks.
ALL of that is much easier & simpler with a handgun, if & when a late-night walkabout's indicated.
Denis