"Potentially fatal flaw" could be discovered for a lot of firearms if, first of all, the user is completely unfamiliar with their operation. The HK P7 was generally viewed in that light - you must squeeze the grip cocker to fire it, no matter what. That is a grip safety in one intent, another to allow carry with the striker completely unstressed and incapable of any release whatsover.
We have seen other firearms which do pre cock the striker and few are noted for having issues with it. Considering the number of Glocks which shoot owners in the leg, hmm. And despited SIG's earnest effort to certify their P320 someone tested it for days and eventually got it to go off in a way no shooter would likely attempt, dropping it from four feet onto the precise angle and orientation to make the trigger release. BTW, as of this moment no PD uses the military version, the M17, which has a different trigger. The P7 was NJ issue at one time.
Goes to the adoption of a firearm for fleet use, it depends on 1) the ability of the maker to provide thousands under the constraints of a contract, 2) the often specified requirement it be made in the USA, and 3) it conform to the slowly changing mindset of PD armorers, trainers, and buyers who require a long term proven-in-the-field firearm which allows the MINIMUM training as municipal budgets simply only allow the least amount possible. As proven in the latest NY terrorist incident, 9 shots fired 1 hit. A very common ratio.
The XD simply doesn't fit those requirements. The reason Glock often does is that it emulates the manual of arms of the DA revolver that it replaced, and frankly, with the huge increase in new shooters in the last 20 years, good. KISS works very well with a large number of users who are neither expert nor well trained. Like cops, most shooters in the large view don't fire their weapon weekly, and get more lint in them than powder residue from engaging bad guys.
As for badly machined firearms - yup. Plenty of them. Evidence directly pointing to what I said, guns aren't getting field tested enough before production ramps up and we get - ? It's a long list - R51, CZ P10, P320, Ruger LCP gen one, Caracal, and I have every assurance posters could add to that.
Now, compare those to this list - a Kahr CW380 purchased three years after it's introduction, a SIG P938 numbered after 84,000, or a S&W 3Gen 4566 TSW. While the early versions did have some issues, the later guns are generally without those flaws. I am breaking in the reputedly jammomatic Kahr with steel cased ammo and it responds appropriately - it goes bang when I pull the trigger. I don't fault it when it won't lock back on the junk fodder I feed it, because when I put Hornady American Gunner in it there is no flaw. The SIG does equally well ripping cases out with its 9mm extractor, SIG had already stopped using the .380 extractor from its little sister and there is no flaw. The S&W? Used PD gun. Would you believe there are still PD's requiring Smith to supply contract full stainless 3Gen autos? Very few, but still - and so goes the XD, it's probably on lists where counties allow it's carry, or small towns accept it because they aren't buying them guns. If you can qual with it - like the P7 - you carry it. It's up to you and your gun.
Now, does the OP have some bad guns, sure, it happens. But it is for him a case of 1 or 2. It's not a fleet indictment of that make and model across the board like some PD's have done, with stats to back it up that thousands of guns of that precise model are having problems. Frankly, if it is a new model fresh on the market that PD buyer better have some good reason to do it - and most don't. They let someone else be the pioneer because they don't have the staff or facilities to do the testing. Exactly why the S&W autos languished on the market place until the Illinois Highway Patrol actually went thru all the motions on their nickel to really test and examine whether a 9mm auto would be better than a .38 revolver. And they did so proving it to their satisfaction.
The gun had been on the market for 20 years, and after Illinois switched others watched. The cascade of changes then started, with dozens of states and hundreds of cities switching over into the 90's. And who finally beat them out? Glock, with an even cheaper gun with simpler controls.
That doesn't mean it's the best for others, look at the worlds military pistols and one with a thumb safety is the international standard. America is very slow to change when it comes to firearms, the general consensus is that a thumb safety is a potentially fatal part as the user just might forget to take it off and it goes click! when he needs bang! And yet millions of us - American citizens - more than 24 million - have trained with those guns provided by the DOD and we don't have a major issue with it. We learned how to do it. It wasn't a lethal threat to us.
There is a bigger picture, and taking the example of ownership of a few pistols and the user's interaction with them does not mean it's a universal truth. If it doesn't work for someone, ok, don't go there at this place and time in your carry. There are plenty of guns out there which can fit each persons requirements. On the other hand, some can handle the others, or even both. A DAO CCW or a SA safety field pistol. Different strokes for different folks.
We do agree, tho, nobody likes a gun that malfunctions. So, don't buy them. Buy proven designs, not the Gun of the Month, one with a long track record of service.