As an inventor I can't financially hope to support a device for a human lifetime and break even, much less profit.
Right to repair and allowing these things to be legally opened and hacked by the end user is the right way, not burdening every manufacturer with unrealistic support laws.
For an example, look at military equipment costs. 20 year support is often built into those to give you an idea of the cost of this. Spoiler: things will cost 10-20x what you think they will for a business to hope to profit.
For example, the amount of bending of the case of a device has to be DRASTICALLY less to allow effectively sealing contaminants out for 20 years vice 2, as well as the seals themselves being an order of magnitude better if there is no servicing involved. For most military equipment we have all of those AND regular servicing, something that consumers would absolutely revolt against nowadays.
One other thing people fail to realize on the electronics front: many of the chips in these older systems are getting very difficult to come by. About 10 years ago I was involved in repairing F/A-18 avionics, and one specific chip in that system was extraordinarily important. It was a radiation hardened 80286 CPU, and had a single production run for the entire budgeted lifecycle of the systems it was in. Unfortunately a design flaw in the power delivery systems meant that the CPUs were being destroyed at a rate roughly 4x as fast as expected and they had to figure out what to do. This specific chip was one of the many reasons (but a key one) that we retired that airframe.
When you start designing things to last a long time AND be very reliable, the cost increases very quickly in ways that are not always predictable.
Germany put the onus on the sellers here. Since 2016 sellers of electronic appliances with a store space of >400m^2 and online sellers with a warehouse space of >400m^2 are required by law to take small electronic appliances (up to 25cm max side length) and dispose of them properly, which usually means recycling, no matter if you actually bought the thing from them or not, and no matter if you buy a new thing or not.
These sellers are furthermore required to take larger appliances if you buy a new replacement appliance from them.
This service has to provided free of charge (except for reasonable shipping costs).
In practice, almost every commercial seller of new appliances, even those who do not fall under the law, will take your old appliances at least when you buy a new similar one voluntarily. Because if not, a lot of customers would just go to a competitor who does.
This spread to other areas too, where e.g. a lot of sellers will voluntary take and dispose of your old mattress when you buy a new one from them.
The sellers do have to dispose of the appliances properly, which is usually also the least expensive option for them. Recycling companies will come and take that stuff for free from the sellers, because they make their money by stripping anything precious out of the stuff.
The area where this is problematic is non-commercial sellers and/or sellers of used stuff. But by law, municipalities have to take all electronic appliances free of charge, the drawback being that they do not have to provide collection/shipping. Getting your old washing machine to the recycling center can be a burden. In my city at least you can call them up and make an appointment for I believe 10 bucks. And they encourage you to tell your neighbors about the pick up time so they can put out their electro trash as well. My city also has about 40 collection containers all around the city for small appliances (up to desktop computer size). The one closest to me is about 7 mins by foot.
Of course, trashing perfectly fine electronic appliances may be a waste sometimes (but sometimes not, because these old things may be extremely power hungry compared to newer models), and a right to repair would be better, but at least it's a step in the right direction.
Thing is, most of the stuff I buy is online. Local retailers taking things for recycling does nothing to encourage the maker of a product I buy online to keep supporting it or open it up for end users (or their local repair services) to support it from there on.
Of course it's good that local retailers offer recycling, it's definitely a step in the right direction, but it's far from having the impact I wish we could have on longevity / support / (semi-un)planned obsolescence.