Perhaps because targeting Linux users isn’t worth the trouble? It would be trivial to implement malware on Linux (e.g. here’s Valve accidentally deleting people’s home directory https://github.com/valvesoftware/steam-for-linux/issues/3671).
Windows, and increasingly Android, suffers from viruses because they’re valuable targets. If Apple made it possible to install apps from third-party stores or websites then they’d similarly suffer.