Writing in The Muaddimah, Muhammed bin Khaldun said that once the soul gets used to something, it becomes part of its make-up and nature, because the soul is able to take on many colourings.
Children require parenting and supervision. They are trained in what is right and wrong by adults. They are rewarded if they do what is right, to encourage them to continue to do right. They are punished if they do what is wrong, to discourage them from repeating wrong conduct.