It could be - not something I have thought of before . I thought of them as stories to explain the world rather than just yarns.
Do you think that the old oral traditions had these stories for the fireside before they were blended into a religious framework and subsequently written down?
Stories about Samson, Cú Chulainn, Asterix all great tales.
Also things like restrictions on eating pigs and shellfish, were they initially practical warnings on food going off?
Yes, exactly what I was proposing. Perhaps some aimed at adults and others written for children, especially the moralistic ones.
Some of the 'historical' OT books, you know, the ones with all the 'begatting' could hardly be described as entertainment. Perhaps they were written for people with sleep disorders.
The Ten Commandments, I am sure, were put together by Moses to deter crime and, being 'the word of God', had the value of instilling fear as, in those days, everyone believed in an omnipotent supernatural being.
As you say, the bit about not eating certain foods was certainly a practical guide to avoiding food poisoning or taking on board such things as tapeworms. As we all know, certain religions still prohibit the consumption of such foods despite the fact that we now know how to avoid illness by, for example, cooking food thoroughly. I suspect they'll catch up with the rest of us... eventually!