Apple has to pay for these somehow. They can either get the money by charging more for each iPhone or they can get the money from the real end-users of these products: Developers.
Programming languages, code editors and other developer tools exist for many platforms, without corporate backing. Developing apps for iOS would be very doable without Apple maintaining XCode.
But Apple are choosing to maintain XCode, not as a charity, but to make money selling phones -- $250 billion last year. It's not like they aren't getting paid for it…
The iOS App Store supposedly grosses around $50 billion USD per year. Let's say that they were to halve their cut from 30% to 15% (very close to what players like Epic are asking for) - cutting Apple's take from $15 billion USD to 7.5 billion USD.
What is Apple spending 7.5 billion USD on such that they'd have to raise the price of iPhones? They have multiple other revenue sources as well, like developer program fees. None of those cover their costs either? Are you suggesting they're selling phones at a loss?
Apple has to pay for these somehow. They can either get the money by charging more for each iPhone or they can get the money from the real end-users of these products: Developers.