Eumenia Just because it's all from one of company doesn't make it more secure.
Indeed, there is no single magic wand.
But in practice if one party gets to make decisions about multiple layers, without needing to reach consensus with a wide variety of independent actors, important structural improvements can be made.
Apple's OS (then called OS X) introduced System Integrity Protection in 2015. Ten years later that is hardly a common feature of Linux distributions.
All Macs starting with the T2 chip (2018) have had hardware disk encryption with instant cryptographic erasure. That can be done with Linux, with some care, if it's running on the right hardware.
Eumenia Can you elaborate how Apple's compiler or language (I assume you mean Swift) is more secure then Androids or Linux?
The GrapheneOS developers have repeatedly stated on this forum that people who for some reason can't use GrapheneOS on a Pixel should consider using an iPhone or a Mac. They have also repeatedly stated that regular desktop Linux is not at all a paragon of security. Thus "Androids or Linux" isn't really one category. And indeed "Androids" isn't even one category. Android on a Fairphone 4 (with a blown bootloader) is not in the same class as GrapheneOS on a Pixel.
There are many details, and many ways to get into trouble. But Apple really has done a lot of work, in hardware and in software, to improve security. And being able to schedule hardware and OS and browser improvements together is part of that picture.