I'm not sure, but I wouldn't mind betting they were based on the tribal cultures. There were three basic ancient cultural streams, the Indus Valley, the Arians, and the tribals. The tribals began in the hills of Assam, on the far east, disseminating west and south. The Indus Valley was on the far west, now Pakistan, and the Arians came from Persia. The Arians were largely responsible for the Kshatriya (pron. shatria) caste on which these two stories are based. The Indus Valley people made up the Brahmans and Shudras. The tribals were essentially animals in the eyes of the castes, and still are.
The principle reason Hindutva and BJP followers today challenge the very concept of the Arian invasions, is because the untouchables are becoming a powerful political force, and they claim to be the direct descendants of the original Indus Valley culture - thus the 'real Indians', whereas the upper castes who are the primary supporters of Hindutva and BJP as not real Indians. Naturally the other side is not happy about this particular spin.
But all agree the tribals are barbarians. It is worth noting the Ramayana is about the battle between the gods of the Aryans against the old gods of the villages and tribals. Thus the bears and monkeys could be seen as the 'good' tribals. In fact, the tribal culture has been a huge influence on mainstream Indian culture, and has revitalised it many times. Tribals are toetemic, while the Arians and Indus Valley people are not. Tribals are also egalitarian, and have open pre-marriage sexual accommodations, in what is known as the youth dormitories. There are villages in the Himalayas who worship Ravana, and always have.