So first, having a multi user system was a good idea, running as a non privileged user is a good idea, and installing software through repos is a good idea. Linux isn't immune, it's just attacked differently and doesn't have the kind of surface area that would make attacks worth the effort. (not that there aren't thousands of linux boxes out there that are borked, they just aren't making the browser slow so people don't complain about it in the same way.
What would work really nicely here, is if apple had the app store as well as repo packages. So installing fdroid-for-iPhone from the play store shows all fdroid apps next time I look for apps. like adding a ppr to a deb box.
I don't know if they could still get leaned on to remove the access to that in the same way, but I would venture to guess that a secondary market for repos could be built in a way that is mildly vetted and also not tied to shareholder interests.
but the type of user who uses Linux was not the same type of user who were most vulnerable to getting viruses back before walled gardens. linux users would be less prone to malware regardless of whether there's a walled garden because they are more likely to have the tech literacy.
not entirely, more a function of it's multi user mode as default and repos. Those two things would have gone a long ways for early windows as well.
It's also worth noting that there are a lot of linux servers in the wild that are hacked serving shitty wordpress malware and spam email servers. Sure the desktop is fine, it's a very small piece of the pie, but the overall linux install ends up running bad software and poor configurations just like any OS.
Add a few hundred million gullible users and you’ll see more malware in Linux Desktop.