That's right, this was an "ask" from the USA in order to implement the T-MEC (USMCA in English). Given the current US political climate, Mexico got the short stick in this new "deal": Tax was increased (from 16% to 17%, 18% and even 19%), Mexico has to implement these laws and we keep being the "cheap maquila labour" that guarantee the country won't develop in the short/mid term.
Under section 1201 of the Digital Millenium Copyright, it would be illegal to install a custom ROM or repair your phone without permission from the manufacturer.
However, the Copyright office get to make official exceptions to the law and they made an exception for jailbreaking a phone. I'm not sure about repairing or installing custom ROMs. Those might fall into different categories.