A rifle or long gun of any type, generally speaking, may not be the right tool for the job at hand unless that is all you have. If your plan is to have a static defensive position in your bedroom with family around you great long gun will cover it.
If I am having to clear my house I will use a pistol. If I am clearing someone else's house and can use dynamic entry techniques I will choose a rifle or shotgun everytime. You must train with whatever you use and again as a general rule traversing corners, doorways and tight spots takes more training with a long gun than a handgun.
If I confront an intruder hopfully I will be better or equally armed as him so tactics and training will push the event into my favor. If I see I am outgunned I am retreating to get a bigger gun to even the odds.