Yes, one's habits and morality are linked to social functions as one learns his/her habits and morality from those around him/her. To suggest that one's habits and morality are ingrained from birth into him/her is a bit silly as babies born in different parts of the world learn different habits and moralities.
All habits (assuming we have them) are determined by the environment in which we are raised and those whom raise us. Therefore the habits we develop influence how we conduct ourselves as individuals. Thou even as individuals we are part of a larger community and that community moderates and molds our views on what is "moral", which conduct is considered "good" which in turn ultimately enforces which habits survive to progress on to the next generation and which get left in the past.