The operant phrase here is just a set.... Atheism can produce a morality that transcends "every man for himself" only in a very small society and only for a very short time.But there is no necessity for that morality. Each person must decide for himself to adhere to a whole code that has no compeling reason for its existence except "the greatest good for the greatest number". Each person will see instances where his own greatest good comes from transgressing against the agreed upon rules. There is no Good rule, no reason for a man to resist doing that which seems good in his own eyes. He feels no God looking over his shoulder. There are no basic rules to felt by everyone or by most to determine that something is to be punished. Everything is arbitrary and those who make and enforce the explicit rules will change those rules to suit their own desires. There is no reason not to, no cultural norms.
So, on the one hand, we have Japan, which has strong cultural, but weak religious, factors that still end up creating a stable, functional society. On the other, we have places like Afghanistan, or even the former Yugoslavia, which have strong religious factors but very weak cultural factors influencing the stability of those societies.
Religion, by itself, is not an indicator of stability for a society.