How can we be certain that Ryugu is a remnant of the material that did not form planets? As mentioned here, that Ryugu is a part of the Solar System material that did not get swept into forming a planet.

But how can we be sure that it was not created later for example by an asteroid striking Mars or some other planet? Why do we think its "primordial"?
Most of my information is from this link. So here's a watered-down version.

When the Solar System first formed, numerous concentrations of mass, called 'planetesimals', formed over time from slowly accreting material. Some of these would go on to combine with other planetesimals and form planets in their own right, but some would simply float in space. Over time, these planetesimals would shatter apart into primordial asteroids from impacts with smaller bodies. However, these remnant asteroids would originate from a single body, so they would have about the same physical properties. In addition with our modern orbital calculation techniques*, we would able to identify groups of these primordial asteroids, and flag them as such. However, an asteroid created from a planetary impact would likely be ruled out as non-primordial, since there would be no "brother asteroids" to compare it with.

*To clarify, we can trace orbits of asteroids back over billions of years to see where the bodies might have been in the distant past. Asteroids that originated from a single parent body would be observed to converge to a single point.