There seems to be unfortunately no mechanism to keep this from happening. This is not the first time it has happened: Libya got the chairmanship in the past, under Gaddafi. The problem is that, as farcical as this seems, how could you stop it? It's not even "the UN's fault", it's what member states vote on.
Any formal definition of not-good-for-human-rights would get vetoed by Russia and China.
To paraphrase a comment, once you start excluding countries for "bad behavior" in one domain, it can spread to other domains. For example, while the subject here is Human Rights, it stands to reason that if lack of performance on a subject triggers exclusion, then this mechanism could be used to deny US membership on any UN climate change committee.
Soft power and persuasion decide these types of things, and the West isn't particularly unified right now. Nor is it immune from criticism regarding human rights.