I read a book a couple decades ago that had an interesting take. A religion can evolve into four possible irreligions:
- Irreligion of Superiority
- Irrelegion of Hostility
- Irreligion of Insularity
- Irreligion of Competition
Unfortunately I forgot the name of the book and the author.
Anyways, I believe Marx was seeing more of the irreligions than religions. Back in my agnostic days, I too was quite quick to point to the flaws of religion, not willing to see the better things religion can provide for society.