Religion was probably a necessity a long time ago (in a galaxy far far away). Absent welfare, SS, worker's comp, food stamps, good paying jobs, equal rights for women, etc., clan/cave/tribe leaders attempted to control human behavior which caused social problems, such as babies without baby fathers. To that effect religion had its place. And sadly many people can't seem to behave unless they have the spectre of fear/carrot/stick/judging to motivate them. Religion, in this regard, kept humans from evolving.
And like anything man makes, religion became way too powerful. With power comes corruption.
So religion was necessary, for a while. It only continues to be 'necessary' because we as a race are too stupid to understand that we can be nice, generous, moral without it. Unless and until that happens religion will still have some benefits. "Civilization will not attain perfection until the last stone from the last church falls on the last priest" (Émile Zola).