Saying that the e-commerce arm is worthless isn't really the right way to think about it - the ads business only exists to due the e-commerce product. Both Amazon and Google are well aware that their ad revenues depend on their having users, who will ultimately leave if the product (ecommerce and search, respectively) isn't compelling. Both of them know that long-term success requires them to prioritize user experience.
Do they make bad decisions, either due to misaligned incentives internally or due to simply making mistakes? Undoubtedly. But it's also worth considering that they probably get the tradeoff right a lot of the time and most people simply aren't bothered by ads nearly as much as you'd like them to be.