The first question to be answered is, "What is a good society?" At a minimum, a good society is one that avoids its own destruction. I can think of at least three ways that a society can be destroyed: internal conflict, external conflict, and environmental threats. A good society is one that keeps internal conflict and external conflict at low levels and adjusts its practices to fit its environment.
Every society has rules, formal and informal. Rules appear to be the way that societies maintain themselves. Two questions arise. First, what should the rules be? Leaders, intellectuals, and activist citizens typically formulate the rules. Second, should I as an individual obey the rules? In part, that depends on how satisfactory the rules are in moving toward a good society (i.e., one that can be sustained in the face of the threats I mentioned). Another possibility for good-faith breaking of a rule is when following the rule produces an outcome that is sufficiently more negative than breaking it. Such exceptions should be rare, or else the whole system of rules is undermined. Then there are those who simply won't or can't follow the rules, without any good-faith critique. Those who won't (in bad faith) follow the rules are immoral. Those who can't follow the rules are not moral agents.
Getting back to the question of "What is a good society?" I would also say that a good society enables or leaves room for its citizens to fulfill their potential as human beings. Survival is good, but to be fully human is also to discover and exercise one's talents and abilities, to pursue goals, to understand and address personal flaws and weaknesses, to connect with others. The survival of society comes first, but once that is more or less secure, the humanist maxim of fulfilling one's potential comes into play.
Why do there appear to be some universal moral rules across societies? In part, it's because we have the same biology. But just as importantly, some practices are obviously detrimental to a society's survival or stifle human striving to fulfill potential. So why are there differences across societies? Because feedback for what works and what doesn't work is imperfect and difficult to interpret. Also, in some cases, more than one way of doing things may work, at least in the short run.