Welcome to the world of pluralistic legal systems. It’s not actually a new world, just one that you may not have noticed. In fact, it’s everywhere, but the force of law in many of the subvariants is comparatively mild, (and rightly so).
A pluralistic society can be defined as “A social system based on mutual respect for each other’s cultures among various groups that make up a society, wherein subordinate groups do not have to forsake their lifestyle and traditions but, rather, can express their culture and participate in the larger society free of prejudice.” (source)
Indonesia is said to be good example of Indonesia a pluralistic society, where people of different backgrounds (religion, caste, culture, language, ethnicity) live side by side.
A pluralistic legal system would be one where different subsets of society are subject to different sets of laws. Religious groups could set standards of behavior for their adherents that are more stringent than state or national laws.
For example, a church could set a ban on same sex marriage, abortion, or use of drugs or alcohol.
Punishments for such infractions could include banishment from church gatherings or parochial schools.
However, repercussions such as those could not be applied to non-members of said churches.
Certain varieties of Christian could be banned from seeking abortions. Others, not so much.
Hindus would have no problem, since they view the 7th month of pregnancy as the point where the soul enters the body. And Jewish law states that life begins at birth.
In the US right now, the Christian view amazingly has been imposed on all, in a sort of mass forgetfulness regarding the separation of church and state.
It’s obvious that the law is not infallible. Laws are rewritten and reinterpreted all the time. The US constitution has multiple amendments (and may need more).
But sometimes laws overreach. The ongoing tension between state and federal regulation in the US is a clumsy attempt to address the multiplicity of values in our society. But no regionally defined system could fairly address the obviously far more granular differences in values, even between neighbors on a single block.
Only a pluralistic legal system can do so.
Excommunication used to be a big deal, and even though it now would be greeted by a yawn in most circles, such penalties and other faith-based restrictions make sense for the subset that they apply to, not the population at large.
Religious penalties are mild in comparison to civil ones, and rightly so.
And, if you don’t like such restrictions, maybe find another Sunday school.
But most of us have an entirely different morning in mind.