But I would strongly oppose anything further than that, such as changes to the physical hardware itself. "It works for the expected lifetime" should be required, but features within that should be up to creators and customers.
Sure, there are exploits for these things, just as there are exploits for iOS.
I'm not sure how you expect "how long a device lasts" to be defined. Manufacturers do typically design with some lifetime in mind, but it's not clear that has any real world relevance. If I buy a phone and stick it in a drawer it's going to last for a lot longer than its designed lifetime, but if I hook it up to a TV and play Fortnite all day it'll probably last significantly less due to the heat.
As far as software updates, although Apple does 3-5 years for iOS, Google has gone from 2 years to only 3 years, and other Android devices still seem to be in the 1-2 year range. So every Android phone is supported for significantly less than the "4-5 years" you seem to expect.
And the reason the repair bills are getting such interest is because the authorized manufacturer repair shops are so screwed up. They don't do any component-level repair, because the training and equipment is expensive, so the choices are just replace, replace, replace.
tl;dr Mandating a 5-year warranty is just handing out free phones everyone
This is a very good point. I've noticed that when companies are on the hook for warranty, they tend to make more repairable products. Example: Hilti angle grinder https://www.youtube.com/watch?v=x9xhr0MsAZw
Those models are oriented toward "fleet" contracts. The Hilti grinder in the above video is designed so that all of the gears can be replaced by replacing the "head" section.
So, effectively, all warranties are 4 years. But you have to go to at least small claims court.
Also, if the defect is within 30-90 days, you don't need to do an RMA regardless of what the seller and manufacturer say. The person who took your money has to take it back.
But I don't agree that this "want" should be a legal requirement. I think it's perfectly acceptable and reasonable that it's possible for someone to cause a level of damage to their property that will destroy said property, leaving it totaled/unsalvageable. In general, where it won't hurt anyone else, that's a matter for individuals. It can be dealt with via insurance, or by buying products that cater to it through higher durability (or conversely just plain being cheaper, spend 1/10 as much and expect to replace them more often).
But that involves tradeoffs and costs which are subjective in value, so I don't think it should be the subject of legislation. The principle I'm stating is fully generalizable, it's not an electronics thing it covers everything. Everything you buy should last under regular use for a reasonable lifetime given the price, no tricks with secret information that the manufacturer knows but that the customer does not. That's foundational to functioning markets. But think about what you're saying, how would it apply to the many beautiful but more fragile decorative things many of us like to buy? Many of those make use of hard but brittle materials like glass. It's reasonable to expect they'll perform as advertises in regular environmental conditions, and not just shatter from regular indoor temperature differentials for example. But if they are dropped and smash parts may not be repairable, and that's fine.
Also, I want to note that as I said in another reply I can fully see and support an exception for any purely soft restrictions like encrypted components. A company shouldn't be able to prevent you from attempting any repair or modification you like on a product you bought from them. I absolutely support a law requiring that at time of purchase you be offered root hardware keys, root software keys, or both (on some devices I'd want both, on some only software). But I'm not in favor of the more generalized arguments for "repairability" that I've seen, and I think it wastes a big opportunity to try to fix a major market failure in America at least. 90 day/1 year standard warranties are utter bullshit.
So basically it's a classic externality problem. Instead the law should simply make sure that "how long a device lasts" matches reasonable expectation. There are many ways to do this, such as saying everything is 6 months minimum for the first $50 and then another month per $15-20 up to a maximum of 5 years, and mandating repair/replace will happen within 2 weeks. The specifics could be hashed out, but the goal should be to makes sure that for the price consumers see advertised they are promised it will than work for a knowable reasonable lifespan for zero extra cost. "Extended/enhanced warranties" should only exist for special commercial/professional use cases, like extreme support periods, specific fast SLA, or advanced RMAs. By law though all standard use should be covered.
Then manufacturers can figure out the right mix of strategies to meet those goals. Repairability might be part of that, because they could satisfy their obligations more cheaply. But it's not the only way or the necessarily right way in all cases, like sometimes additional QA or better design upfront (reducing failure rate even if each individual failure or more expensive) would be more important. Or just having large enough margins to eat the cost if they can add enough value in other ways. It's a bad idea to have government mandate the method, what government should do is mandate the goal and the goal should be that products last, at zero additional cost. That way everything can be compared with no digging.