Why are nepotism and self-aggrandisement considered threats to democracy, and how can democratic institutions guard against them?

The Supreme Court has stated that nepotism and self-aggrandisement are anathema to democracy. I want to understand why these issues are harmful and what mechanisms can be used to prevent them in a democratic system.