EU actually did that:
> These regulations will empower independent repairers and end-users by ensuring access to spare parts and to the information necessary to repair for at least 7 years after the end of the distribution of a product in the market. Additionally, manufacturers will have to make compatible software updates available for at least 5 years.
https://repair.eu/news/new-eu-rules-smartphones-and-tablets-...