In any status-conscious society (read: any human society), given enough time, the people who make it to the top will invariably maximize opportunity afforded to their affinity group (i.e. offspring) at the expense of everyone else. This process manifests itself regardless of the role merit plays in the sorting algorithm. If the rules are relatively meritocratic (and relatively stable), and merit broadly defined is largely a heritable trait either via genetics or culture, it follows that given enough iterations, a structure will eventually emerge that exhibits strong nepotistic tendencies. The growing call for greater diversity and equity among high-status occupations is a reaction to this phenomenon.
Alternatively, many long-lasting power structures throughout history attempted to mitigate the phenomenon of hereditary nepotism via the policy of enforced celibacy among the elite class: eunuch advisors in many classical near-Eastern empires, Catholic clergymen, etc.