Most of the matter in food comes from water H2O or Air CO2 + N2. Nitrogen fixing bacteria are literally getting that nitrogen from the air not the soil even if they live in the soil. https://en.wikipedia.org/wiki/Nitrogen_fixation
Modern agriculture uses fertilizer for extra nitrogen (N), phosphorus (P), and potassium (K).
Plants also need a few trace minerals from soil but it’s a tiny fraction of their mass Iron, Calcium, etc and can also be added back: https://en.wikipedia.org/wiki/Rock_flour
PS: There’s some really destructive agricultural like sod that’s literally shipping soil, but the premium pays to replace the soil.