Religion developed to cope with the unavoidable misery of human existence through a coordinated belief in an imaginary afterlife free of that misery.
Enlightenment, science and technology showed us that most of this misery could be alleviated by advancing our technologies and social structures, while also revealing the imaginary nature of ideas of an afterlife.
The tragic thing is that we might live in the worst time of all: religion is obsolete, yet the transformative changes possible through technology might very well stay out of reach during our lifetimes.