The actual popular phrase is mātā pitā guru daivam. We would discuss below on the basis of some texts and traditions, of how this saying is valid.
We see in the famous orally recited story (which is also present in some Purāṇas) of Gaṇeśa and Kārtikeya, where both had a contest of racing around the world, and Gaṇeśa just circled around his parents because his parents, for him, embodied the whole existence itself. And by this ingenious and filial act, he won the race as well as the approval of his parents (that was equivalent to the very gods praising his victory). Like in this popular story, the emphasis of parents being gods and superior to them has been quite intrinsically present in the Indian traditions and culture since the Purāṇic period and even earlier as we would see below.
To begin the search, dharmaśāstras and dharmasūtras are the most important textual sources since these are concerned primarily with the religio-ethical sphere. The dharmaśāstras and the didactic sections of the epics are unanimous in praising the mother. But the praise is expressed in formulaic and stereotypical manner. First, the mother is represented as one of the three atigurus, equal to dakṣiṇatya fire, devotion to whom leads to the attainment of this world.
A man has three atigurus. His father, his mother and his guru. (Viṣṇusmr̥ti 31.1-2 ; Rāmāyaṇa 2.103.2)
(The father, the mother and the guru) are the three Vedas ... to the three gods ... to the three worlds and to the three sacrificial fires. (Viṣṇusmr̥ti 31.7, ; Manusmr̥ti 2.229 ; Mahābhārata 12.109.6,8)
The father is the household fire (gārhapatya), the mother is die southern fire (dakṣiṇa) and the teacher is the sacrificial fire (āhavanīya). (Viṣṇusmr̥ti 31.8 ; Manusmr̥ti 2.231 ; Mahābhārata 12.109.7)
By loving devotion to his mother he gains the world, by loving devotion to his father the middle world; and by obedience to his guru, the Brahmaloka i.e. world of ultimate reality. (Viṣṇusmr̥ti 31.10 ; Manusmr̥ti 2.233)
Yājñavalkyasmr̥ti (1.157-8) further adds that by avoiding quarrels with one's mother, father, guests, a and so on, a householder can conquer all the worlds.
The guru is the embodiment of Brāhmaṇa, the father is emobodiment of Prajāpati and mother is the embodiment of Pr̥thvi. (Manusmr̥ti 2.226)
The trouble that a father and mother endure in fiving birth to human beings cannot be redeemed even in a hundred years. He should constantly do what please both of them... when these three (mother, father, guru) are satisifed, all austerities are accomplished. (Manusmr̥ti 2.227-8)
Manusmr̥ti (2.133) further emphasizes mother is the the most important of all female kin. We see even in some epics how the reverence of mother is given importance. Kaśyapa ascends to heaven because of obedience to his mother (Rāmāyaṇa 2.18.20). Rāma is of the opinion that righteousness lies in submission to the commands of the father and mother (Ibid., 2.27.29 ; 2.69.27), and instructed Bharata to forgive Kaikeyī, for the mother commands reverence just like father. And so, there is no lack of further examples in itihāsa texts which eulogize mother and motherhood.
Disrespect, physical or verbal violence or abandonment of mother, father, guru has been recorded to be not good.
A man who abandons his mother, father and guru (mātā pitā guru tyāgi) without valid reason, is listed among those who are not invited to a śrāddha. (Yājñavalkyasmr̥ti 1.224 ; Viṣṇusmr̥ti 82.29 ; Manusmr̥ti 3.157). Mitākṣarā makes it clear that guru refers to both the father and mother. (Yājñavalkyasmr̥ti 1.216 and the Mitākṣarā on Yājñavalkyasmr̥ti 1.216)
Furthermore, Vasiṣṭhadharmasūtra (15.19) prescribes loss of caste for those who strike their mother, father or guru, and it is prohibited to injure/hurt either of them do so. (Manusmr̥ti 4.162).
So, above we can already see the development of the respect and eulogization of parents (especially mother), father (which was already quite common in patriarchal traditions) and guru. Although all of them praise the three and show their importance to one in being revered, yet none of above mention the hierarchy explicitly present in the popular adage mātā pitā guru daivam.
However, this issue is also cleared up in the next verse.
In veneration, the ācārya (teacher/preceptor) excels ten upādhyāyas (sub-teachers), a father more than a hundred ācāryās and mother more than a thousand fathers. (Manusmr̥ti 2.145, Vasiṣṭhadharmasūtra 13.48 ; Yājñavalkyasmr̥ti 1.34-5).
Mahābhārata (13.105.14-5) mentions mother to be equivalent to ten fathers. Furthermore it states that there is no shelter like the mother, no refuge like the mother. There is no defence other than mother, there is no one dearer than the mother. Some regard the mother to be more worthy of respect than the father because she perfroms a more difficult task of bearing her child. (12.258.29 ; 3.196.15)
So, we get already get the hierarchial order of mother, father and guru.
Taittirīyopaniṣad (1.11.4) states:
Let your mother be a goddess unto you. Let your father be a god unto you. Let your teacher be a god unto you. Let your guest be a god unto you.
The idea simply here is that the mother, father, guest are to worshipped/adored/revered as gods. We already saw in some of the previous references where the functions of mother, father and guru are shown extremely important in karma (ritual activities, duties etc. in this case). And so they instead become important in the way leading to god.
In his famous dohā (couplet), Kabīra states that if he encounters both his guru and God on his way, he will first bow down to his guru as his guru is the one who showed him where to look for god.
Guru govinda doū khaḍe, kake lagū pāya |
balihārī guru āpne, govinda dīyo batāya ||
This element is common not only in devotional traditions where Guru is accorded a respect greater or equivalent in god but in many other spiritual traditions as well. Often in commentaries or texts, it is seen that the authors in the dedicatory verses salute the guru alongwith or before the God, because it was the guru from whom they got their wisdom to pursue the path of divine.
Thus, I would say that the popular traditional saying mātā pitā guru daivam although may not be found explicitly in the same wordings in the canonical texts, but it's elements are already present in both textual and oral Indian philosophical/spiritual traditions. This saying is actually more of a mishmash of a whole lot of literature, philosophical texts, oral tradition etc. On the basis of the above mentioned references, one can very well see how they fit together in the phrase mātā pitā guru daivam.
Uncited Reference
Ray, Ujjayini (1999) 'Idealizing Motherhood' : The Brahmanical discourse on women in Ancient India (circa 500 BCE - 300 CE). PhD thesis. SOAS University of London. https://doi.org/10.25501/SOAS.00028499