This is one of my pet subjects...
I worked in electronics and then manufacturing for years and I think there are a number of problems. Of course cost comes into it as manufacturers often buy poor quality components as they're scrimping or because the suppliers tell porkies or because they don't really know what they're buying and of course some designers lack ability or even basic knowledge. On top of all that testing may be poor, inadequate or non existent and there's pressure to get stuff to market and that can lead to stuff being less good than it could be.
I saw some real shockers in my time, quite apt for electrical kit
but I think that possibly the worst example was when I looked at a known and potentially dangerous fault and when I went to talk to the designers it was quickly clear to me that they just didn't have the in depth knowledge to be able to design the kit. It was really just basic stuff for me but rather than lose face by accepting what I was saying they discontinued the product which I suppose stopped more from entering the market but didn't do much about the kit already out there.
Products can't be perfect as they'd be vastly undercut by the mediocre competition and later to market and a generation or two behind because of all of the extra care and testing and of course a good product may be made less good because of what the supplier or a replacement supplier ships.