I wouldn’t say all of the privacy changes or even the majority of them are to ensure lock-in, but they have certainly been using their privacy stance as a pretext for lock-in.
If Apple cared about privacy ssh would be well supported OOTB and you'd be able to build your apps from the source.
There's no way to do this, even if you pay all the fees push notifications won't work unless you publish to the app store and that will get rejected for being a duplicate.
Like all corporations, Apple only cares about making a profit. Their business model let them implement much stronger privacy guarantees than their competitors, and this differentiation has been a profitable avenue for them. But ultimately if there’s any lock-down they can get away with (i.e. without affecting their profits either directly or via fines and legislation) they’ll try it, and privacy/security misfeatures are a great way to couch these regressions without appearing directly hostile.
That being said, I don’t think Apple’s privacy stance is all hot air, they publish plenty of white papers on their infrastructure. I mostly think they’re greedy and don’t mind harming the user and developer experience to ensure they get their cut from every transaction that occurs inside their ecosystem.