Back in the day, it came from those things.
I remember watching a documentary about farmers in an isolated enclave somewhere out west. And one guy wanted to marry his girlfriend an he recollected that the first time he saw her, he knew he had to have her. The way she fed the chickens, the way she picked the corn, the way she got up early to milk the cows. He knew she would be a good farm wife and that was all a man like him wanted.
When a woman, in a traditional culture, had healthy babies and worked the farm and cooked hearty meals, etc., she was cherished and she knew her role and value in the bigger scheme of things. Not saying she might nt have been oppressed, too. Or whatever. But in her mind, she had value. She wasn't on Prozac, she wasn't trying to kill herself, she wasn't drinking herself blind at the saloon and letting different guys climb on top of her. Maybe she was bored and maybe she didn't have rights, but she wasn't questioning her reason for being born or wishing she was dead. (Not saying it's OK for ppl not to have equal rights.)
But as roles change, ppl have to carve out new niches for themselves and it doesn't always work. Well, yes, I can cook a great, hearty meal for my family and use what I don't cook for clothing and to grease the wagon wheel axles. But oh wait, my family likes McDonald's and my househusband shops at the gap. Cow fat isn't indicated for the BMW I can't afford.
I can't speak for other religions besides Christianity but yes, the message of Christianity is that God loves you, God thinks you're great, God sent his only begotten son to die for you because he loves you so much and wants you near for all of eternity and he wil bear any burden, stress, worry and problem for you out of his undying love for you and will move mountains and work miracles and never leave you and he made you in his image and has a customized plan just for your life, and has given you guidance and never-ending forgiveness and powers and talents and blessings beyond what you can understand, etc. So yes, for the believer, it provides an instant, unconditional sense of purpose and belonging.
I guess critics keep focusing on some perceived oppression or whatever that women and gay ppl experience in religion. But I believe that is a misperception. Yes, the husband is supposed to be the leader of the family, but in such a way that his role is to serve his family and lay down his life for it the way Jesus did for the church. And gay ppl are loved just like anyone else. We are all equal and all loved in God's eyes, according to the Bible. But God doesn't condone all behaviors...from gays or straights alike.
But anyway, yes, the message of Christ is one of unconditional love.
But as ppl move away from that, then there is a need to build one's value alone, in the eyes of self and of others. Yes, ppl can derive a sense of self worth from school and careers. But that would be a different wordview.
I might have bitten off more than I can explain here.