What ultimately provided the fundamental atomic building blocks (heavy elements) for the Sun and Earth?
Pre-existing molecular clouds already enriched by earlier generations of stars.
The role of the Sgr Dwarf interaction relates strictly to the mechanical 'timing' or initiation of the collapse, not the source of the physical matter itself. The necessary heavy elements—such as carbon, oxygen, and iron—required to form rocky planets and complex molecules were already present in the interstellar medium prior to the Solar System's birth. These elements were forged in previous massive stars that lived and subsequently died, exploding as supernovae long before our Sun ignited. The disturbed gaseous layer, though compressed by the dwarf galaxy's passage, already contained this prior enrichment necessary for terrestrial planet formation.

#Videos
How Did Our Solar System Get Here? | Universe | BBC Earth Science