I don't think that is an accurate statement. While I'm not sure about Apple's OS, I can say for sure that Windows, despite its widespread use, has indeed experienced its fair share of security issues over time. Even though developers work diligently to patch vulnerabilities, hackers continuously find new ways to exploit weaknesses in the system.
Windows 10 most critical vulnerabilities in 2022
That's how open source software works. Yes, you do have to trust a third party, but unlike closed source software, it's not just one centralized entity; rather, it involves numerous programmers and security experts from all over the world. Moreover, the more popular the software, the safer it becomes because it attracts more attention and undergoes scrutiny from an even larger number of users.