Because scientific discovery does not grant a feeling of community or purpose that religion does. In fact, in most situations it robs the psyche of both.
I think people have community because they are social, and a sense of purpose because the desire to live makes them come up with one, or several. Science is one expression of that, Religion is another... but neither "grant" any of it, that's hilarious. Though religion loves to take credit for it, of course. Before they came to Sinai, the Jews didn't even know murder and theft were bad things, nobody had told them!
Yeah, right. I remember Hitchens being quite indignated about that one, and though I often found him a bit too much, that's one of the bits I fully agreed with; the idea that religion gives people morals is patronizing nonsense.
And even if we assumed it's the other way around: Being a Star Wars fan also gives a "feeling of community or purpose", as does being a member of a criminal organization, or even being a drug addict (doesn't even have to be very hard drugs, though that certainly helps). Heck, pure greed can do that, just look at Silicon Valley haha... disrupting markets with oh so aweseome gadgets while rubbing shoulders with oh so smart people seems to be very intoxicating for some, at least they can't stop blogjaculating about it. Have you seen the movie "Slither"? You could say it's about a group of people finding a new sense of community and purpose, too.
But again, I think it's the other way around. Our desire to have community and to see(k) a purpose creates both religion and science. Though also our failure to love and and live with purpose can create pseudoscience, and religions obsessed with unbelievers and unbelief. I'd say community at the exclusion of most is not community, it's a walled garden *within* the human community that existed before any of them. Religion, at worst(!), is a bunch of people disappearing up trees, and science at best(!) is, among other things, looking where they went. Religion proceeds to fling poop, hilarity ensues.