I think you'd be hard pressed to take the $99/yr they make from the dev program fee and use it to cover the salaries for the engineers implementing and maintaining all of iOS' developer-facing APIs.
There's plenty of precedence for platforms being profitable even with free APIs - including Android, Windows, and even Apple's own MacOS. iOS is not special.
Apple would pay for those APIs whether or not the dev program fees alone were enough to cover the expenses. But they'll also take as much from the devs as they are legally allowed to. And if the fees are enough to keep devs from distributing outside the app store, even better for Apple.