Democracies are weird. Many of the most primal problems of mankind are solved. The rule of law is (in theory) impartial, citizens have property rights, etc. etc. There is free press.
Most people living in democracies don't really understand - or just don't think about - how good they have it. At the same time, the human brain is wired to react strongly to outrage. Living the sweet life in a democracy, and with less valid things to outrage about, the brain is vulnerable to outrage exploitation about manufactured controversies, like who must bake a cake for who, or whether this statue or that should be allowed to stand in the park. Social media hostility and polarisation flourish.
But when the chips are down and democracy itself is at stake, people wake up and start thinking more rationally about the things that really matter.
Case in point from a news article this morning - Ukraine is normalising LGBTQ attitudes rapidly because suddenly their democracy is at risk. And suddenly it seems more sensible to have your LGBTQ neighbour alongside you in the trenches rather than hating on them because of your weird religious hangups or whatever (https://www.politico.com/news/magazine/2023/03/07/russias-wa...).
So perhaps democracy does indeed shoot itself in the foot, but perhaps also the system can be self-balancing when things finally go off the rails or a threat from outside arrives.