One can still do C# development using only Windows SDK and/or dotnet SDK for "free".
You cannot do C/C++ or Rust developement without a license but with MinGW you also can do it without MS SDK. MS doesn't prevent people from using GCC compilers. Their core C++ developers even use it: https://nuwen.net/mingw.html
Apple could have said at the beginning "hey this is iPhone, there are no external apps for it though" - which was actually the case! iPhone did not have 3rd party apps at launch.
Then Apple could have said "good news everyone, you can now develop for the iPhone. Dev kits start at $10000 per unit, apply to partner with us, call us at this number" and that would be the end of it. Lots of gadgets still work like that and nobody bats an eye.
Apple decreased the barrier to entry and provided it as a service, charged for it but created good value in return, and it worked! But now that governments signal that they will punish such success, the next Apple will likely not go the way of low barrier of entry - this will hurt the regular folk, people with not so deep pockets.
The point is, nobody is disallowed from competing with Apple and its ecosystem on its merits. If Apple didn't provide enough value in return to what they ask, they would fail. Signaling that you will punish success with force means that the next Apple will be a lot more cautious about how they do things. Jacked up prices (as long as value proposition is there, people will pay, they will just pay more), requiring dev kits (can you force a company to change their hardware design so that it can be developed on? where is the limit?) / expensive partnership agreements / increasing the barrier to entry... Unless companies are "state owned" they have infinite ways to keep their profits at the expense of consumers. Apple's existing deal was a good deal - it was working, competition was (and is still) there. Now they will have to do the things that will just inconvenience users as a side effect, which is what they don't want to do, but they will be forced to do regardless.