Homogeneity is 1 factor, others are having a large resource rich landmass and using slavery to build the economies. More factors are enlightenment traditions / culture.
At the moment most of the best countries are White majority, but many people will argue this. But you are failing to acknowledge that the reason Western countries are nice is because they are not as tribal , patriarchal, anti gay, anti secular , racist as many other non-White countries. Also having access to large resource rich landmasses.