I think the logical basis was most likely to isolate groups from other tribes. We don’t live that group over there. That group over there is trading pigs. It is a new rule, no the law, that you can’t eat pig. No more trade. A generation or two pass and the logical basis is lost to time.
The cow is sacred in India, so they don’t eat beef. Most of the Western world won’t eat dog or cat, but that isn’t a universal thing and while probably not as common today, it doesn’t mean that it’s an unheard of practice. Until recent times, people would eat what was available which didn’t have alternative value.