Because a belief system that tells people to avoid doing certain things can actually be beneficial to the overall population.
Like not eating pork or shellfish. Not only is the allergy thing a potential factor in saving lives but if these meats aren't cooked properly they can straight up kill you.
Or things like banning homosexuality (I'm not homophobic by any means this is me trying to explain it in the basest way I can). If you're gay you're not gonna be having children of your own (most of the time, I know gay people who are closeted can and will have children to hide their sexuality) which could potentially end a bloodline which could end a population.
Not every part of a belief system is based on stuff like this but a lot of them are. They were used as a method of keeping the human population as strong as possible especially during times of crisis.
With all this said imho religion needs to die. We're no longer apes hiding in caves with no way of understanding what's happening around us. They were useful when humanity was in it's early stages of development but hold no value in the modern age