The simplest answer is that in democracy, the benefit of majority rules.
Many aspect of capitalism benefit majority.
If Burger King have to compete with Mc Donald, there are far more people benefited by their competition. On the other hand, trade restrictions and monopoly hurt the majority of people.
Hence, in most cases, again and again, majority of voters vote in favor of rules that are aligned with capitalism.
It's natural that majority of people, who are customers and workers, vote for capitalism.
In area where the number of people that are made worse off are larger than the number of people that are made better off, the people do not vote in favor of capitalism.
A way to test this theory is to see whether democratic country is still "capitalistic" if competition affect the majority of people.
For example, do we have free market on labor market and sex market? In those cases, the number of people that will be made worse off under capitalism start becoming significant. Hence, we do not have free market on labor market and sex market.
So, capitalism govern which cell phone. Capitalism do not govern how many wives you can have in democratic countries.
Capitalism reduces incentive to be dictators
Another reason I can think off is that under capitalism you can get rich anyway normally. Hence, you do not need to be dictators to be rich. This reduces probability that a country would end up being lead by a dictator.
https://www.nytimes.com/2007/06/13/world/europe/13iht-letter.1.6120596.html
Basically, in free market economy, most people have a way to achieve success. Hence, they do not fight toe and nails to have more power over others.
In the absence of capitalism, the way to be richer than others is to be king. That is, one guy got all the vote.
With capitalism, I can be Bill Gates. A peasant like Bill Gates can be rich. So I don't bother if power is "socialized" I have other way to be "ubber alles". Namely getting rich productively.
This is probably why socialist countries end up being authoritarian. To get rich in socialist country you need to be the de facto king. You can't get rich normally. And that's what success no matter what minded people do. They become dictators, corrupt officials, etc.
Democracy can lead to socialism
I see an opposite factor where democracy may undermine capitalism and people that want meritocracy may want to avoid it.
In democracy, wealth tend to get redistributed to voters. However, these wealth redistribution is actually not very efficient. If the market decides a start up founder should be 10000 times richer than a blue collar workers, then that is simply what's "optimum". Under democracy, some of the money would go to the more numerous blue collar workers to get their votes.
So a way a country can create wealth more quickly is to keep workers out of power. Hence, a country can get very wealthy without having to raise minimum wage.
And that's what's happening in China.
What's ironic, is that China, being a communist country, is more capitalistic and meritocratic than a democracy. If it were a democracy, then the wealth disparity will be less.