The actual statement referring by the question is from the book titled Mathematics of Egypt, Mesopotamia, China, India, and Islam: A Sourcebook. The particular statement is
Brahmagupta discusses the illumination of the moon by the sun,
rebutting an idea maintained in scriptures: namely, that the moon is
farther from the earth than the sun is. In fact, as he explains,
because the moon is closer the extent of the illuminated portion of
the moon depends on the relative positions of the moon and the sun,
and can be computed from the size of the angular separation α between
It does not mention the name or type of the scripture that contain the idea that the moon is farther from the earth than the sun is. So we cannot say explicitly that the idea came from vedas only. Based on the information available, the idea can be from any (Hindu) scripture.
In this context I am providing some explanations from some scriptures or texts that deals with the idea that sun is nearer than moon. But it should not always be interpreted as the physical sun and moon as we use them now.
The moon and sun in yogic parlance are related to the names of mandalas inside the human body. It is evident from many yoga scriptures that surya mandala comes before chandra mandala, which should not be confused with astronomical objects.
Consider the following paragraphs from the text named Tirumantiram by Tirumular for clarification
669: Beyond the Eight Siddhis in the Moon's Nectar
By eight-limbed yoga are Siddhis eight attained
When breath is in accord controlled;
But when Kundalini fire is through the Central Nadi coursed up,
And the Sun's mandala passed
Beyond that is the Moon's
Whence flow the ambrosia that may swilled be.
746: The Days it Takes the Yogi to Traverse Adharas and
The days that take to pierce the Centers nine are this:
Twentieth day adharas six;
Twenty-fifth day Seventh Center of Fire Mandala
Twenty-sixth day the Eighth Center of Solar Mandala
Twenty-seventh day the Ninth Center of Lunar Mandala
--These the days for yogi's Prana to reach Centers nine
Since the mandala of surya(sun) is nearer to muladhara than chandra(moon), a yogi can reach surya mandala first and then chandra mandala, which is farther.
The following are the words by swami Vivekananda, which expicitly states that the solar sphere is observable universe and the sphere next to observable universe is lunar sphere, which is not same as the moon.
The eschatology will be explained from the Advaitic standpoint only.
That is to say, the dualist claims that the soul after death passes on
to the Solar sphere, thence to the Lunar sphere, thence to the
Electric sphere. Thence he is accompanied by a Purusha to Brahmaloka.
(Thence, says the Advaitist, he goes to Nirvâna.)
Now on the Advaitic side, it is held that the soul neither comes nor
goes, and that all these spheres or layers of the universe are only so
many varying products of Akasha and Prana.
That is to say, the lowest or most condensed is the Solar sphere,
consisting of the visible universe, in which Prana appears as physical
force, and Akasha as sensible matter.
The next is called the Lunar sphere, which surrounds the Solar sphere.
This is not the moon at all, but the habitation of the gods, that is
to say, Prana appears in it as psychic forces, and Akasha as Tanmâtras
or fine particles.
Beyond this is the Electric sphere, that is to say, a condition in
which the Prana is almost inseparable from Akasha, and you can hardly
tell whether Electricity is force or matter. Next is the Brahmaloka.
where there is neither Prana nor Akasha, but both are merged in the
mind stuff, the primal energy. And here — there big neither Prana nor
Akasha — the Jiva contemplates the whole universe as Samashti or the
sum total of Mahat or mind. This appears as a Purusha, an abstract
universal soul, yet not the Absolute, for still there is multiplicity.
He explicitly told that This is not the moon at all probably to clarify the wrong interpretation of statements from scriptures that sun is nearer than moon to earth.