They can't do that with physical SIMs, because at least in the EU, there are regulations against that (to regulate stuff like phones and SIMs locked to each other)
https://en.wikipedia.org/wiki/SIM_lock#European_Union
It seems sim locking is legal, but unlocking has to be allowed after some time.
I couldn't see anything that would differentiate between a carrier lock by esim vs a sim.
I'm not sure that would happen wouldn't most telcos be interested to allow as many users on the network as possible?
With the above in mind, note that it just so happens that telcos sell mobile devices as well as the service. This means they'll make money on increasing device churn.