Mahabharata's time was a transition
time – from Vedic to Puranic.
This is evidenced by the fact that Kunti and Madri sought to sire their children from the Vedic pantheon and not the “trinity", so popular in the Puranas.
Kunti, Madri and Pandu chose from the original Vedic pantheon of Mitra, Varun (Yama / Dharma), Vayu, Indra and the Ashwinis.
Mitra was the original solar deity, friend to all lifeforms. (Mitra = friend) Kunti chose Mitra / Surya to sire her first son.
Varun / Yama was originally the
god of righteousness – an earlier version of Dharma.
As kings must be righteous, Pandu chose him has the ideal God to sire his first born.
Vayu was the god of strength, as
can be seen from Ramayana when he sired Hanuman – the strong man of that epic.
Kings require strength to maintain their empire, so Vayu was chosen to sire the second child.
Indra was the petulant God of
heaven who could shower his mercy or withhold his grace in the form of rain.
As Lord of heaven and king of "devatas", Indra was chosen as the ideal god to sire the third son.
Ashwini twins were probably pre
Vedic Gods and dealt with herbal lore, healing and health.
They were chosen as the ideal gods to sire the fourth and fifth sons by Madri.
Later, Vishnu and his avataras
became more popular in India.
Krushna and Rama became the most popular avatars of Vishnu.
Shiva and his various forms was also popular in Mahabharata times, as can be seen from Kirat-Arjun and vision of Mahakal by Ashwashthama.
As this was a transition time – between old and new – sometimes the text of the Mahabharata prefers the older gods, sometimes the newer ones (Krushna and Balarama). Sometimes the Vedic gods require the help of Krushna, Arjun and sometimes, they help these heroes in their own battles. Conflict between followers of Vedic Gods is highlighted by the fact that Indra and Agni stand on opposing sides concerning the Nagas. Agni wants to consume them. Indra wants to protect them. In the epic, Agni and Indra clash on two occasions over the Nagas - during the burning of Khandav forest and Janmanjaya's Sarpa-satra.
Agni wants Khandav forest to be burned down with everyone inside it. Indra is opposed to the idea and sends torrents of rain to protect the kingdom of his Naga friend Takshat. Krushna and Arjun help Agni carry out his plan and burn everyone except Maya danava. Takshat was in Indra's court at the time and hence escapes the conflagration. He tries to kill Arjun but fails and takes out his vengeance on his grandson Pariksheet.
Situation worsens to such an extent, that the brahmins in-charge of Janmanjay's Sarpa-satra attempt to sacrifice and kill all snakes in a yagna of epic proportions. When Indra tries to save Takshat, sages and brahmins in charge of the yagna prepare to sacrifice Indra along with Takshat ! Sacrificing Indra, using sacred Vedic mantras would have been unthinkable in the Vedic times. In this transition time, between Vedic and Puranic influences, everything was possible !
Vedic Gods of heaven would not
require humans to fight for them.
Puranic gods of heaven seek humans to fight on their behalf.
In Puranic legends, the Trinity are infallible and defeat the heavenly gods with ease.
Mahabharat reflects these changes in people's perception of their Gods. There are legends, myths and histories from all corners of India. Some of the stories are of pre-Vedic Gods, tribal Gods, Vedic pantheon and new emerging Gods. Mahabharat is a reflection of the social, spiritual and philosophical milieu of its time.
This is not to say GOD is one thing
or another - or that new GOD / GODS came and went. Mahabharata reflects
changes in human perception of God(s).
Hinduism's singular GOD (Brahman) is polymorphic and has changed form(s) over the centuries to keep pace with the visions of his worshipers. This has allowed Hinduism to survive the test of time and adopt to evolving attitudes of devotees towards divinity. Western world finds it difficult to reconcile with an idea of a polymorphic God who can change shape, form and function. Fixed with Abrahamic ideals of a singular God who is unknowable, they often mistake Hinduism's polymorphic God as a pantheon of demi-gods jostling for power and position. Hinduism's vision of an omnipresent, omnipotent God is one who can take any form, as many forms, at anytime and place of God's own choosing. For this reason, Hindus are comfortable with God being represented in various forms - human or otherwise. Maybe it's because of this that the society at the time of the Mahabharata was so comfortable worshiping Indra, Shiva and Krushna with equal zeal.