If one wants a slightly lighter-touch regulation strategy, instead of directly mandating that "a phone must have security updates for n years", legislation could require that (a) CO2 emission cost used to manufacture (b) MTBF (c) warranty period and (d) guaranteed security+OS update lifetime be included on the packaging (like nutrition labels). Then, when shopping, consumers can see that the $700 phone has a 5 year MTBF (and is repairable) while the $400 phone has a 2 year MTBF - similar to the unit prices that are already included on grocery store price tags.
I gave it to my daughter who just started secondary school here in the UK. She had to have it switched off at school, and switched it on when she left so a few hours of charge was fine until she got home. I got her a new phone that Christmas, but for a few months she got good use out of it.
But I think the call for the Right for Repair is needed. Mandating companies provide (at least security) updates and keep parts availability for 10 years seems like a good thing. I doubt Apple will keep supporting the 5s forever, and even so that's currently the oldest smartphone with current security updates. The next closest (outside of iPhones) is Samsung at 4 years and Google at 3 years.
Even if the phones will get slower and don't get fancy new features, I know plenty of people that are still happily using 5+ year old phones. And manufacturers should definitely be required to provide security updates long past that point.