Apologies if this is a bit intro polsci, but I've undergone a bit of a magic eye switch in terms of democracy that I can't seem to flip back. What if the majority of the population genuinely believes or is coerced into believing that something intrinsically immoral should be law e.g. slavery, unethical experimentation, endless overseas wars? Is this an instance where we want an autocratic figurehead like the President or Queen to step in and override the will of the people? In this case, is that good and desired? I legitimately do not know how to reconcile this in my stupid lib brain that assumes democracy = good. Obviously not every working of the state can be left up to the people, but where is the line? Is it really democracy if you can only actually vote for things the state deems as morally good? Should the people be allowed to vote for things that are reprehensible because that is a lesser evil than tyranny? Who determines what is ethical? And is it better to leave that judgment to a tyranny of the majority than a statesman? Does a democratic electorate even have any imperative to consider the morality of its decisions?
So your argument is that the most important thing to prevent corruption of a democratic state is education and solidarity. I like that.
I'd also add that a classical liberal view to this problem would likely be that a solitary leader or oligarchy is much more corruptible than an electorate, so the point is moot: a ruling class would be more likely to be imposing immoral laws than vetoing them in the first place.