Sure, though they may chose to wipe iOS from your device if you unlock it. Then you are free to build your own os and execute root level code if you wish.
South Korea is already doing significant laws that are at least related to this conversation.
I expect more countries to pass similar laws soon.
You will love in a world where you own nothing, and have less control over your life than a medieval surf - all devices are becoming 'smart', frok door locks to toasters