How do religions become petite bourgeois/ bourgeoise dick riding machines?
I'm not sure if this question has been asked before but let's take Jesus as an example, most of his 'blessings' or 'miracles' mostly appealed to the slaves and oppressed people's that were under the Roman heel and after his death, Christianity somehow consolidated itself as a world power. Same goes for Islam because there's no way any of the Islamic conquests could've happened without soldiers recruited from the common people who I will refer to as the proletariat. I apologise for both the misconception and hasty generalisation, if my views of these soldiers as proletariat is wrong please feel free to correct me but unfortunately that's not the crux of my question.
From what I understand of communism, society goes through many stages and those stages arise from revolution I e from feudalism to capitalism to communism. My question is how to religions go from something that leads the common people to overthrow their oppressive rulers to basically becoming the maintainer of oppressive social structures. Is there a Marxist analysis of this somewhere? I don't understand historical materialism very well but can the answer be found there?