It's a very good question. As far as I know, these relationships are taken for granted from the earliest times. For example, Yāskācārya's Niruktam (7.5) just states without explanation:
तिस्र एव देवता इति नैरुक्ताः । अग्निः पृथिवीस्थानः । वायुर्वेन्द्रो वान्तरिक्षस्थानः । सूर्यो द्युस्थानः ।
There are only three deities according to the school of Niruktam. Agni is the deity based in the earth. Vāyu or Indra is the deity based in the atmosphere. Sūrya is the deity based in the heaven (outer space).
I can deduce from various scriptural passages that although Agni himself is considered as omnipresent and omnipotent (Brahman), with Vidyut (lightning) in the atmosphere and Sūrya in heaven as his forms, the predominant forms of each deity reflects the predominant function.
So, Agni's predominant form of physical fire needs earth-based materials to manifest, although he is present everywhere. Vāyu the wind can manifest only in the atmosphere. Indra who again predominantly represents atmospheric activity, can manifest only in the atmosphere. And obviously, Sūrya the sun is only manifest in outer space (heaven).
Another Vedic symbolism is that the earth is the first thing to manifest during creation, and the other worlds are supported on the earth. And Agni is supposed to have been "churned" out of the earth, just as he is "churned" out of the two fire-sticks (adharāraṇi and uttarāraṇi) - RV 6.16.13:
त्वामग्ने पुष्करादध्यथर्वा निरमन्थत । मूर्ध्नो विश्वस्य वाघतः ॥
Atharvan churned you, O Agni, from the lotus ("earth"), from the head of every rishi.
Further reading suggestions:
- Essential nature of Agni in Rig Veda
- Agni - Part 2
- Agni - Part 3
EDIT: As per the OP's request, I will add some notes on the quoted text मह इति चन्द्रमाः
The OP's question is why the moon is assigned the highest place in the vyAhRtis (maha), whereas the sun is assigned a lower place. Shouldn't the sun be the source of all light, and hence be assigned maha vyAhRti.
I first searched in the traditional commentaries of Adi Shankara and Sayanacharya. Neither has anything specific to explain this passage. They both have one common explanation for all four groups of mahah as Atman/Brahman.
My best guess is that the moon is associated with Soma, who is praised in the Vedas as a supreme deity. For example, Rig Veda 9.96.6 says:
ब्रह्मा देवानां पदवीः कवीनामृषिर्विप्राणां महिषो मृगाणाम् ।
श्येनो गृध्राणां स्वधितिर्वनानां सोमः पवित्रमत्येति रेभन् ॥
Brahmā among gods, leader of the poets, RShi among sages, bull among animals, hawk among the birds, sharp knife among tools, Soma overflows the filter roaring.
Sayana's commentary on the above mantra makes it clear as well:
देवानां स्तोत्रकारिणामृत्विजां ब्रह्माख्यर्त्विक्स्थानीयः यद्वा देवानां ब्रह्मा राजा भवति । ... कवीनां पदवीः ... विप्राणां मेधाविनां मध्ये ऋषिः । यः परोक्षं पश्यति स ऋषिः । मृगाणां महिषाख्यो बलवान् राजा भवति । पक्षिविशेषानां श्येनः शंसनीयः पक्षिराजो भवति । ...
Among the Rtviks (priests) he is Brahmā (i.e. the supervising priest), or among the gods he is the king, Brahmā... Leader among the poets... among the wise people, he is the RShi - he who has vision of metaphysical truth. Among animals, he is the bull, the king of animals. Among birds, he is the hawk, the king of birds...
So you can see why the moon (Soma) is assigned the mahah vyAhRti. In reality, all the Vedic gods are overlapping each other.
Another hint comes from Purusha Suktam, "...candramA manaso jAtah, cakShoh sUryo ajAyata, mukhAdindrashca agnishca, prANAd vAyurajAyata..."
This implies that Agni, Vayu, Surya are the presiding deities (abhimAnidevatA) of the sense organs and Chandra is the presiding deity of the mind. Since the senses report to the mind, the mind can be called the "king of the senses", hence through that connection, the moon is the mahah vyAhRti.
As regards the explicit mention of a relationship between the mind and senses as a controller-controlled relationship, there are many references. One such is in Katha Upanishad 1.3.3-4:
आत्मानं रथिनं विद्धि शरीरं रथमेव तु ।
बुद्धिं तु सारथिं विद्धि मनः प्रग्रहमेव च ॥
The Atman is the rider, the body is the chariot, the intellect is the charioteer, and the mind is the reins for the horses.
इन्द्रियाणि हयानाहुर्विषयांस्तेषु गोचरान् ।
आत्मेन्द्रियमनोयुक्तं भोक्तेत्याहु्मनीषिणः ॥
The senses are the horses, and the sense-objects are the pathways for the horses. The Atman conjoined with the senses and mind is called the 'Enjoyer'.
So the mind (reins) controls the senses (horses).