Once they sell you the device, then it is yours, not Apple’s. That is the doctrine of first sale. It is why you are allowed to resell it, and in general use it as you wish.
The problem is that even after selling you the device, Apple continues to deny you the ability to install the programs of your choice.
No they cannot. You know that as well as I do. There are laws preventing them from doing loads of things, and for good reason.
If you’d like to make the argument that you think Apple should be allowed to do the specific things in question, namely to unilaterally disallow competing app distribution channels and to deny consumers the ability to choose which programs run on their devices, then make that case.
But saying Apple is allowed to do anything it wants is patently false.
And if you want a gemstone from a competitive market you can buy a ruby. The fact remains that DeBeers had a monopoly on the diamond trade for decades, regardless of what the ruby market was like.
What Apple is doing right now is anti-competitive. It undermines the free market, and it subverts the rights of consumers to have full control over their own devices.