Whatever you use for a home defense weapon make sure you get professional training on it! The ar 15 might be right for some houses, but in apartments,mobile homes etc I think a handgun is better. I have been trained only on pistol and shotgun so I'm definitely not using a rifle unless I get the proper training. But whatever you use please make sure you get proper training, punching holes in paper standing static at the range isn't enough. In most residences an ar15 is unrealistic, good luck moving down the hallway of a single wide trailer or an apartment with one. Weapon retention training and force on force training and for the love of all that is good learn to point shoot! It's great to use the sights but most home defense situations aren't at rifle range they are within 15 yards.
Frangible ammunition exists that should break up in the walls of your home. 5.56 is pretty common for that to be cheper and more avalible than say 5.54 frangible. (not currently for obvious reasons, 5.56 is scarce)
If you get barrier blind 9mm ammuntion it can go straight through your walls , or even go straight through somone and through your wall. Just look at the Underwood pentrator rounds, they zip through quite a lot.
Plus, long guns for what i have seen are largy for bunkering down or property defence. eg, you dont clear your house with then, you sit with it poitning at your door or at a choke ponjt waiting for the person to come into your line of fire and shoot them.
I would also argue and say if you can use a shotgun so-so effectively you could transfer sufficent skills over to use a rifle so-so effectively. You arent going to be the fastest at magzine changes etc, but so long as you know how to charge it and take the safety off etc, you should be good. You arent likely to need to reload anyway. Vice versa as well for rifle to shotgun. (semi automatic more so than slide though)
You can argue about training all you want, its not economical for some people nor is it going to stop somone grabbing a pistol to defend themselves. And its not nessisarily good training. And if you live in a place that crime is so bad, the amount of times you would have to use your firearm would probbly comp your need for formal training.
addendum: actually thats where a shotgun might be better, birdshot and no 3-4 buck doesnt over pen and usually stops in walls and is fairly common and cheap for shotguns, and thats pretty good home defence ammuntion. Might be chepaer on average than frangilbe rifle ammuntion.