According to wikipedia, Linux's security compared to Windows is generally due to "the malware's lack of root access."
Why doesn't Windows just fix this?
Windows did fix this.
That claim on Wikipedia is based on an article written in 2005 (i.e, the days of Windows XP). Back then, it was pretty normal for users to run with full local admin rights (including almost all home users, and a significant number of corporate users). This was mostly down to badly written software that tried to write to folders inside
C:\Program Files or bits of the registry that are only accessible to admins.
When Microsoft released Windows Vista in 2007, they introduced User Account Control (UAC), and took various other steps to try and encourage users to use with non-administrative accounts, and to only elevate their privileges (with UAC) when required. This is a large part of the reason that so much software didn't work properly on Windows Vista: it assumed that users would be running with admin rights, and that was no longer the case.
The point is not so much that Microsoft did not solve this. The point is that Windows users are/where used to being administrator all the time on their PC. If, on a Linux distribution, you would always login as root (like Puppy Linux did) and do all your work as root, you do not have this security advantage.
Windows users still do not seem to be used to using normal accounts in stead of administrator. There are still a lot of questions like "Why am I not ADMINISTRATOR of my own system?" or articles like "Why You Should NOT Be Running a Windows “Admin” Account".
For many years, Microsoft had a very poor security model for their operating systems. They didn't design for security, but kind of tacked it on after the fact. Windows 95 (and prior) did not have any privilege separation or memory protection between programs. Windows XP had privilege separation and memory protection, but came with all directories world writable, although there were guides and kits that explained how to lock it down and add permissions to fix this. Windows XP (except for bugs) could have been as secure as linux, but they chose to distribute it to install as not secure. The Microsoft code writing style of itself also had security model problems that caused a lot of security bugs in windows. It didn't help at all that software authors coming from DOS and Windows 95 expected the system to be wide open and any attempt at securing Windows NT/XP, etc. would break that software.
More recently, Microsoft has done a good job of trying to fix this. They now have a sane security model. The operating system comes with everything locked down. Coding style has gotten much better and a lot of the operating system has been rewritten to fix security problems, but there is likely still a lot of unexamined legacy code that hasn't been looked at in 30 years. Windows 10 is probably very close to contemporary linux in terms of security. However, even today with Windows 10 and Windows 11, there is third party software that breaks when users don't have admin access.
Having said that, Linux has had its fair share of security holes. The pace of new CVEs for linux has been very high in the last 2-3 years. This is likely do to the growing popularity of linux and the huge malware and ransomware industry that is attacking both linux and windows. In the last 5 years, linux has had its fair share of devastating security holes found in 10-20 year old unexamined code, along with serious bugs in new code. The "many eyeballs" theory of open source finding bugs faster is probably well balanced against the ease of bad actors getting access to code to find bugs themselves as well as (successful and unsuccessful) attempts to inject bad code with back doors into the open source community.
So, 10 years ago, I would say Linux was more secure just because Microsoft had a poor internal security model. Today, I think Windows and Linux are probably pretty even in security level.