i think a part of religion is for survival of the tribe rules about things being unclean like pork some wise person of the tribe saw that people who ate pork died a screaming death from trichinosis and decided that it was unclean and ways to keep from passing sickness around
The laws of Kashrut fall into the category of Chukkim -- laws with no meaning other than discipline. It is written in the Torah, and that is reason enough. Trying to find reasons for these regulations is made easy for us with our current knowledge, but at the time, one becoming ill and dying because of something he/she ate would have been observationally possible only if the symptoms appeared within a short period. For trichinosis there is a minimum of two days before anything would be noticed and several weeks before it becomes critical.
As for the rules of religions, their dogmas and dictum, there is little doubt that they were aimed at maintaining order, identity (special status of the group), and survival, but these were coopted from things passed down the line from the time we were small clans surviving on the African savanna.
well the wise person might have seen it in the pig farmers