The Cave of Wonders
Aladdin's Cave of Wonders permits only “the diamond in the rough” to retrieve the lamp. Why? It's inevitable! The cave contains at least two items which can break causality: the carpet and the lamp. (The itinerary in A Whole New World proves the carpet can time-travel.)
Any timeline which contains causality-breaking technology/magic is unstable. Suppose Jafar or someone like him gets the lamp: eventually he will do something paradoxical (“I wish that rat Aladdin had never been born!”), and poof! that universe ceases to exist.
Therefore, in an infinite multiverse, the Cave can arise from random variation; only those universes with such a protection can survive. Alternatively, the Cave might be instituted retroactively by the emancipated genie, which ensures its own survival (h/t @cstross's "Iron Sunrise").
(but only “good” genies which don’t break causality can survive, so again we’re left with a very similar type of Cave.)