>Was it serendipity or loving compassion?
Yes.
Or, more accurately, it's historical inertia. Macs are "computers", iPhones and iPads are "devices".
The arguments that Cupertino used to defend against Epic in court were roughly that Macs were inherently less secure than their locked-down devices, and that this was a deliberate security trade-off that they were not willing to allow iOS users to make. In other words, something you carry around in your pocket is such a potent malware and spyware vector that users cannot be trusted to decide for themselves.
I personally think this is a half-truth. If Apple had started with portable devices first and then scaled up to the Mac, rather than them starting with PCs[0], they absolutely would have tried to sell it locked-down. Both the tech and the impetus to lock down the iPhone did not exist when the Mac was first made, and the iPad is evidence of this. While there are legitimate user-interface reasons for iPads not running macOS, there is no argument for why they can't have the same security policy as a Mac[1]. But it was borne from iOS[2] and intended to displace personal computers, and thus inherits all of the iPhone's baggage, including the App Store lockout with no owner override.
Since Macs were always open, Apple's management can't insist on locking the system down without pushback both internal and external. Software developers expect to be able to ship their own software ecosystems and users expect to be able to have full control over their Macs. Locking down the Mac makes it a worse Mac, because the product is defined by it's openness.
[0] The Mac and everything that came before it.
[1] Nor is there an argument for why Apple TV can't have an owner override, either. It's even less capable of spying on you than your Mac!
[2] This is actually backwards; the iPad came first as a tablet tech demo and then it's tech lifted to make the iPod Phone work. But then Apple backported the finished phone OS onto the iPad, which is where all the iPhone-isms come from.