What you’re describing is already the case, the law you want is that people who sell things have to give you the keys, tools, specs, and parts necessary to do the modifying.
Can you please tell me in what country that is the case, and to what extent?
What do they do about vendors that don't cooperate, like John Deere, or Sony?
(Serious question, not sarc. It definitely is not the case in the US, and the country that already has such laws might be a good indicator of a good place to move).