Religion also provides inclusion for those that would otherwise feel outcast. It provides social structure and identity. It provides a framework for you to build culture upon. It acts as a moral guide for behavior. It unifies communities around central goals. It uses myth to convey inter-generational wisdom. It teaches rituals that improve mental and physical health. It provides dozens of important things.
The idea that religion is just about an individual doing X or Y to feel like they have "meaning" or "purpose" is nonsense. Religion evolved as the foundation of human social order. It's about communion and community, not self-indulgence. We know from our earliest architectural sites, like Gobekli Tepe, that religion preceded even the agrarian forms of human society. It's part of who and what we are.
It's extremely arrogant to call it detrimental, especially when our "post-religious" society - where everyone claims a god of their own but no one practices anything - has a workforce composed almost entirely of alienated, corporate slaves that lack more than half the things I mentioned in my second paragraph and a non-working population that suffers in silence because they offer no "economic benefit" to the rest. We are hardly enlightened in any meaningful sense of the word.