You have heard of macOS haven't you? You do know that most apps that run on it a sideloaded and not hosted on the Mac App Store, right?
You do realise that there is $0 dev fee to access all the same dev tools for macOS, and any other OS in the world? Even though you can develop macOS apps and sideload them and not pay a single cent to Apple anywhere in the process? Tell me why that is, but somehow iOS/iPadOS are so special and expensive?
The answer is simple: 1)Security , 2) privacy, 3)revenue. It is in this particular chronological order ( will explain why). I won't even get into the technical differences. I will keep it simple.
If you want the simple chronological order, here it is:
Prior to 2007 - Mac Security was strong due small user base so the platform could stay open for side loading which did not sacrifice the measure.
2007 - iPhone came along with strong security focus as mobile devices contain way more personal information. No App Store existed at this time. Ran only Apple apps.
2008 - App Store came along which opened the device for developers but kept the security focus in check by not allowing sideloading.
2010 - Apple made a corporate decision to also add "Privacy" as part of their core offering.
And in 2021 - Apple still defends its stance that kept for decades and people like you evaluate the situation based on what it looks like right now rather than looking at Apple's entire history.
It is misleading looking at the situation in snapshots. App Store revenue didn't become an important focus until much later in time. This should be evidence enough for you that Revenue is actually NOT Apple's focus. It just happens to be a good consequence of their right decisions through the years.
Here is more detailed look if you feel like reading:
Mac was always allowing apps and software to be downloaded even before the Mac App Store. It was also always the platform with a very small number of active user base even to date (around 100 million daily active users). As the time went on though, Mac App Store came along in addition to tighter sandboxing requirements. Even unauthorized apps needed to make sure to work with Macs sandboxing even if they were downloaded outside of the Mac Store.
iOS, on the other hand, was always very locked down. The first iPhone didn't even have an App Store until a year later. It ran only apps made by Apple, nothing else. This was back in 2007 when Apple didn't even have any idea how popular the device would be or even lead to the App Store a year later. Apple's App Store policy was pretty much the same even back then.
Fast forward several years, iOS now has over 1 billion active daily users. That's more than 10 times the Mac user count.
Since the very beginning, Apple designed the iPhone with security in mind since it is a mobile device people cary with them all the time which means more private information with sensitive information hackers would love to get their hands on. This became even more important as the iOS active user base grew significantly. This large user base would make a very good target for cybercriminals and scammers. Sideloading would lead to new focus into attacks on iPhone. This was never going to be the case for Mac since 1) It is not a mobile device 2) Has fraction of the active user base which isn't very enticing for hackers.
And lastly, revenue because the subsequent focus as the user base grew and app downloads contributed to service revenue. This, however, does not invalidate Apple's previous focus on security and privacy just because later on it also meant strong revenue.