You're confusing the different metrics at work.
Capitalism is about capital accumulation. People who are good at achieving capital accumulation, by whatever (hopefully legal) means, become rich capitalists.
Democracy is about the will of the voters. Since it does not have a metric to optimize for outside the will of the voters, it does not actually care if the voters are complete idiots.
Democracy uses the will of the voters as a tool to build a good society for the voters, in the same way that autocracy uses the will of a philosopher-king to build a good society for the subjects. It, or rather the people who set it up, didn't give a damn about the will of the voters per se; what they wanted was the wellbeing, agency, and other CEV stuff of the population. You are confusing their means with an end in itself.
Another month has passed and here is a new rationality quotes thread. The usual rules are: