The count of exactly four mahavakyas is itself a later fact, not an Upanishadic one. The Upanishads contain many sentences asserting identity between self and Brahman; the selection of one per Veda and the label mahavakya for that set belongs to the systematising phase of Advaita after Shankara. The Vakya-vritti, a short verse commentary traditionally attributed to Shankara though its authorship is debated by scholars, is among the texts that fixed the set and its reading for later students.
The four sayings then acquired an institutional life beyond exegesis. The monastic orders founded in the Shankara lineage trace themselves to principal mathas, and tradition ties each matha to a Veda and, through it, to a mahavakya, so that a renunciant's initiation links him to a specific text and a specific monastic house at once. Accounts of exactly which matha holds which mahavakya differ in the sources, which is itself evidence that the scheme hardened gradually rather than arriving whole.
Outside Advaita monasticism, the mahavakyas took on a second career in the nineteenth and twentieth centuries as exhibits in a more universalist Hindu apologetic addressed to the West. Popular addresses have quoted tat tvam asi as a summary ethical claim, that the same reality is present in every being, rather than as the technical identity statement Shankara argued for at length against rival readings. That popular gloss is widely repeated and is not the reading the Advaita commentarial tradition itself defends; it belongs to a later, outward-facing presentation of Vedanta more than to the classroom transmission described in the first article.