Others have done a good job answering you, but I just want to add that there's a whole body of theory and scholarship that calls your mental model of this into serious doubt. It's called public choice theory and it essentially concludes that politicians, bureaucrats, and other officials are just as driven by selfish interests as anyone else, and that democratic systems typically do a very bad job at channeling that selfish energy toward the public good.
Forgive me for being sentimentalist a bit, but I think that nowadays we underestimate the weight that feelings of duty, loyalty, and trust had on rulers of times past. They were raised from the day they were born to be leaders, to care deeply about their family honor, to feel obliged to their subjects. Certainly, they were ultimately fallen men like the rest of us, and hereditary succession is not great at picking the best of each generation.