The biggest reason MacOS hasn’t seen much malware isn’t the fact that MacOS is necessarily safer than Windows or other operating systems.
Of course Linux or *BSD (OpenBSD especially) are safer than Windows!
https://www.liquidweb.com/blog/what-is-openbsd/
“OpenBSD has only had two remote code execution vulnerabilities in the entire operating system’s history.”
Compare it to Windows and what they got so far.