If we set aside all the fallacies of a monotheistic religion, even as an atheist I can understand some of why religion has a basis in history.
In a time when there wasn't science, people needed to explain what they couldn't understand. God or gods filled the void. Even in those days two plus two equaled four. If your people didn't have monogamous relationships, terrible diseases would fall upon the people. Still true today. I am not saying that lifestyle is wrong but the best way to protect yourself is, well, to protect yourself. Our ancestors didn't have that option.
Similarly to eat pork, the non cud chewing cloven beast, was to partake of the unclean animal - historically trichinosis would and did kill many of humans. It was God's will. Or just a way to explain what couldn't be understood at the time. The same for shell fish and red tides.
Religion is now, as it has been in the past, a way to explain what we do not understand. As humans have evolved into a more scientific understanding of many aspects of life, it has been difficult to resist the change against what would appear to be proper etiquette in terms of the mores that have dictated human morality for eons.
We should at the very least in our journey pay homage to the history that got us to this level, even as we reject it. The earth is not the center of the universe. We now know where sexually transmitted diseases come from. Safer husbandry practices have all but obliterated trichinosis in swine. Nothing is quite like bacon. (My humble apologies to the vegans out there.)
It was the best humanity could do at the time. Yes, it is time to move on, but. . . it is our collective history. From east to west, north to south, religion has been the way humanity has defined our cultures and our societies. Right or Wrong. I am proud to be part of the movement to a more rational, educated way of thought, but there is still respect due for how we got here.