It doesn't take a ‘village' to raise a child, but it takes parents. If they do a good job, society benefits from their efforts. Babies don't come into the world with a sense of morality, they are a blank slate and it's their parents that will fill in the void.
The first thing a child needs to learn is obedience. They have to be taught the authority adults have over them. Without obedience children will run wild, ignoring their parents and society's rules. They won't last long violating their parent's rules. Ignoring the rule "Don't cross the street" can result in the kid becoming road kill.
Once the child grasps the concept of obedience, it time to teach moral responsibility. That's the hard part. If the parents are immoral, they have no basis to pass on the concept to their offspring. Fortunately most parents have a sense of morality. The best way to pass it on is by example. If a child sees their parents acting morally, they will emulate them and develop a sense of moral responsibility. Parents are not alone in this job. They have help from their Church, relatives and friends.
Religion may be "The opiate of the masses," but it is a great teacher of morals. It doesn't matter which religion, all subscribe to the same basic moral principals. The Christian concepts of "Do onto others as you would have them do onto you" is ubiquitous to virtually all religions. In Judaism, the Torah can be summed up as "Don't do to your neighbor what you would not do to yourself."
It is when the parents fail that society steps in. It has the responsibility to keep order, and obedience and morality are essential to that goal. If caught early, the child will have some chance to become a productive citizen, but society as represented by the state is an inefficient teacher. It usually fails, then both the child and society are the losers.