I've got 5 recent high end phone purchases that seem to counter that.
#1. Housewife. Convinced to get the S4 because of the Samsung brand. Already in Samsung "ecosystem" because of a high end TV, suspicious of HTC quality control issues which she researched. (see #5).
#2. Travelling sales guy #1. Paranoid about forgetting or being unable to recharge. Carries 3 or 4 spare batteries at all time. Replaceable battery of S4 is a killer feature for him.
#3. Travelling sales guy #2. Lemminged what the #2 guy did.
#4. Travelling sales guy #3. Media junky, doesn't want to wait for cloud storage or deal with occasional streaming issues. Bought S4 because of SD card.
#5. Developer, liked the aluminum and speakers of HTC One, has access to broadband always so SD card is no big, can always charge, doesn't want a case. His HTC One failed after about 3 weeks of ownership, he's now in the process of getting it replaced by an S4.
To that I add another co worker whose iPhone 4S contract has not yet expired. He is loathing the sealed battery, his iPhone is giving him less than 8 hours on a charge (he recharges from a car charger). He's planning on replacing his iPhone with an S4, largely because it's important to him to continue charging from a car charger, and once the battery is damaged to the point of uselessness he'll simply replace it.
Then there's me and my wife. She takes TONS and I mean TONS of pictures for her real estate business. She buys 16 gig sdcards in bulk. There's not a data plan on the planet that'd let her cloud that much data in real time. Probably not getting the S4, but LG G2 is likely if it has an SD slot. HTC One can't be considered.
And last but not least, there's yours truly. I expect to hack the living crap out of my phone, so having a larger installed user base and bigger community is important. If I had to buy the phone today, this very instant it'd be the S4. Was considering the X until pricing was announced, now waiting for the LG G2 as well.
Total: 5 actual and 3 potential sales for phones other than HTC One, having very little to do with marketing. One size doesn't fit all, people's needs are different. For some the Samsung brand, or SDCard, or battery are far more important than optical image stabilization, an extra 16G of onboard RAM or boom sound.
The fact that the S4 has a microSD slot and replaceable battery can't account for the difference in sales. For every case that you mentioned, there are many more people who don't use/replace either. I appreciate the anecdotes, but not everyone is in sales or real estate. I would argue what those people need more than anything is a proper secondary camera or a large external battery, anyway. Carrying and swapping batteries isn't any more convenient than charging on the go, unless you don't mind rebooting your phone or plugging it in and then swapping. Plenty of third-party battery/case solutions exist for the HTC One, by the way. Even paying for a battery case, the HTC One can be cheaper or the same price as the S4.
For long term replacement, very few people are running down the phone so much in 2 years (the length of a contract) that the battery doesn't retain most of its charge anymore. If you are in an industry that requires heavy phone use, I'd expect that you would likely upgrade your phone more often than most, anyway, unless you are the kind of person who sticks with an old Blackberry.
I'm not saying the S4 can't be used in that way, or that it isn't a decent enough camera to use as a dedicated camera, but 90 percent of the market isn't sales people and real estate agents, and I'd still say a DSLR or mirrorless with microSD (or the Lumia 1020, which doesn't have microSD but takes far better pictures than the S4) is a far better option. Or just offloading shots like most people do. Which you really should do. Backing up is important - good luck recovering critical hundreds of photos because your microSD fails. Flash memory isn't 100% reliable, the worst thing to do is fill up a 64GB microSD card without offloading it to a computer or other device. Onboard filesystem can be corrupted, too. Most Android phones have USB OTG. 25GB free on the One is a LOT of pictures, even for a real estate agent - I would offload all of that to any mobile computer, tablet, or other device with cloud backup unless you don't mind risking losing any of those shots.
If those make up most of the S4 owners you know, I'm betting you are in either industry or related field. That's like if I said most of my friends are in the music industry and vastly prefer the HTC speakers/Beats audio, or if I say I'm a writer or food critic and prefer the One's because it does low light better. I'd argue there are more people that have those specific needs - or others that the HTC One targets - than the real estate agent or sales person. I know exactly one person who swaps batteries out of all the smartphone owners people I know. I would argue that there are far more music fans who listen to music from the speakers
at least occasionally than there are people who absolutely need replaceable batteries.
HTC isn't winning those kinds of sales because of one reason: marketing.
The quality control issues might have been the only real issue in your list, but I haven't heard anything lately that suggest the HTC One is worse in that regard than the S4. What I have heard is some bad press about Samsung lately in other areas, which doesn't seem to be affecting sales.
Anyone who does their research should see that HTC One is the S4's equal at the very least and better in many ways. I'm sure there are hundred different scenarios in which on is better than the other, but my point isn't to say that the HTC One is absolutely the best phone for everyone. But you would have to be more than blind to not see that marketing is the major reason the GS4 is outselling the One.
Bringing this back to the Moto X, Google and Motorola seem to be taking an approach more along the lines of the One than the S4, and we can see with the purported $500 million marketing budget if it will do well even without microSD or replaceable battery. A few months is all it takes to see if I'm right.