Linux attempts a much harder task than MacOS, in trying to be compatible with a wide variety of hardware. That it's even considered remotely comparable to a product that's sold only on a few supported platforms at a time is impressive. (In fairness, Windows manages this too, although it does it by forcing most of the work on hardware vendors and OEMs to do driver development and integration, respectively.)
Although a few companies have tried over the years to do Linux preinstalled on private-label hardware, thus taking the hardware-compatibility and installation issues out of the picture, there's sort of a chicken-and-egg issue with doing it at scale. Apple has managed to always have just enough volume to compete with commodity systems (even if just barely compete, particularly on price) but present a tightly-coupled hardware/software package.
Power 32 bit is dead. Apple never ventured into other architectures. macOS (and OSX 10.whatever plus since the mid 2000s) are running on x86 and stumbling towards ARM; iOS runs on ARM. It's still commodity hardware, just like Windows and Linux.
I understand that Apple supports a much smaller set of hardware and drivers, but in my mind it's not really 'integration' the way, say, dinosaurs like SPARC + Solaris or POWER virtualization under AIX is integrated hardware with software. I'm really just being cranky here and splitting hairs.
Linux ... takes what you throw at it. It does this pretty damned well most of the time, but I've lived and seen the challenges.
Broadcom chipsets. Nvidia. Dell's so-called RAID controllers (PERC). WiFi.
Audio, trackpad (at least for single-touch), networking, and WiFi not so much any more, though bootloaders and telco kit remain issues.
Apple owns the software that runs on their computers. None of these problems will ever happen to Apple. This has been around:
None of my Classic software runs on a modern Mac. No PowerPC software runs on a modern Mac. I think those problems do happen to Apple's users.
The one company which does take this sort of thing seriously is … Microsoft. I hate using their OS, and so I don't, but I gotta respect them for that.
What I mean is:
Market share of Mac is tens of times more than Linux.
Not because its that much better.