The problem is that F1 is about advancing engineering as much as it is about driving skills.
Rather than stock cars, F1 needs to be more like pinewood derby. Everyone gets exactly the same materials to work with. Literally the same factories, the same windtunnel, the same carbon fiber, the same tires, the same everything. Teams can make as much money as they want, but every team has exactly $X to spend on developing the car. Just like in Warhammer where your army can only have X points of units no matter how wealthy the player is.
Whoever can make the best cars out of the same (very large) pile of stuff, and also throw in having a great driver. That’s where it’s at.
There is the separate problem where advantages of car matter more than advantages of driver. A middle of the pack driver in the top car is going to win or come close. A god-tier driver, even Schumacher or Senna in their prime, could not make a piece of shit car win the race. If we want to test driver skill more, the design of the cars and tracks needs to be intentionally restricted as to make driving vastly more difficult. I can’t say excatly what those changes should be, but it is theoretically possible.
A simple idea that could be implemented very easily is a luxury tax and revenue sharing like what MLB has. You can avoid having the strict salary cap, which is also bad because it is an unfair cap on labor expenditures. Yet, you can also help achieve more competitive balance. Teams can spend as much as they want, but if they spend more than X, they have to pay a penalty tax. That tax money goes to the crappier teams, who now will have more money to spend and become competitive.