So yes, you can legislate that. By making merchants bear the cost of defects and take a loss on replacing the product, you make it no longer a viable business model to constantly sell broken stuff. It's a proper alignment of incentives.
In a world where Google is being sued for antitrust in part because of a monopoly they built by giving stuff away for free, perhaps making it harder to have a "low margins, but we aren't accountable for anything" business is not a bad thing.
You're also building a strawman - that Google would need to spend a lot per user on customer service to start actually providing customer service instead of refusing to do so for most of its products.
It would need to spend a lot in absolute dollars, sure, but the vast majority of users would have precisely zero support interactions. No one is saying that Google should have an army of 500,000 support reps. Just that it should actually be possible to contact Google without knowing someone who works there.