Why would a hereditary system work any better? Plenty of monarchies based on heredity ran themselves into the ground.
Heredity is only one of many flavours of cronyism.
It provides an additional check. Much like a monarch, a noble's interests are tied to the welfare of the country itself. Without the country, they're just a toff with some money and an overinflated sense of self-importance.
It's interesting how people never even learn about any upsides to that. Even if the balance comes out on the side of elected officials, it's good to at least have some idea of why so many societies have worked like that (other than "they were dumb and evil I guess").
The main thing is long-term stability and limits on backstabbing and ruthless competition. Sure it doesn't bring it to zero, plenty of bloody examples from history. But when someone gets close to power for the first time and might be out of there quite soon, and have to watch out for being replaced quickly, they will behave quite differently than someone who plans ahead in decades and generations (if all things go well). If you have a short time under the sun, you better extract all you can while it lasts.
It's kind of like a lifetime appointment or like tenure, except also across generations. Tenure allows professors to ignore short-term ups and downs and allows them some resilience and slack (though funding is still an issue). Similarly a nobleman can "relax" and take a longer-term view on things. The failure mode is that they stop caring and become lazy and just enjoy their position.