"Linux" had a bug in which you could log into a system by pressing backspace 28 times a few years ago. And by Linux, I meant GRUB[1], and in turn, (many) Linux systems.
We're comparing Linux and Windows, an operating system that contains 3.5 million files[2] (of course, not just the kernel in this case). That isn't really fair. Code is as perfect as humans can make it, and it certainly does not help that there's so much to take into account.
[1] http://hmarco.org/bugs/CVE-2015-8370-Grub2-authentication-by...
[2] https://arstechnica.com/gadgets/2018/03/building-windows-4-m...