Children inherit the qualities of the parents, no less than their physical features. Environment does play an important part, but the original capital on which a child starts in life is inherited from its ancestors. I have also seen children successfully surmounting the effects of an evil inheritance. That is due to purity being an inherent attribute of the soul.
As soon as we lose the moral basis, we cease to be religious. There is no such thing as religion over-riding morality. Man, for instance, cannot be untruthful, cruel or incontinent and claim to have God on his side.