If SpaceX launches a Starship in 2026 or 2028 for an uncrewed or crewed Mars landing, seems like a great opportunity to send ridealong technology to collect the samples and return them to Earth.
My understanding of the problem is that it would take something like the mass of a StarShip payload landing on the Mars surface to provide for both a rover to collect the samples and a launch-to-Mars-orbit craft with enough fuel.
But, then there is still the return to Earth part of the journey to get the samples from Mars orbit to Earth reentry. I'm not sure if one StarShip could provide both.
The major holdup seems to be that NASA has been trying to figure out how to do it with very much smaller spacecraft, due to budget concerns.
The early SpaceX missions to Mars have an entirely different focus, and don't have the available payload mass for sample return ride-alongs, so those NASA missions would probably be paid for as whole once-and-done StarShip missions. Still not likely to fit NASA's budget. SpaceX earliest StarShip launches to Mars are apparently expected to be one-way, probably filled with robots and habitat manufacturing equipment for them to assemble and operate on Mars without humans present.
I think NASA was getting out to 2040 for the return mission, without any StarShip involvement, anyway.
We have been terrible at predicting technological advancement rates in the past, so what StarShip is capable of doing at various points in the future isn't really a good planning basis. (Think about the technologies that the movies "2001" and "2010" showed, compared to where we really are in 2025, not to mention Musk's proclivity for making unrealistic schedule statements.)
When we say "StarShip" these days, we tend to think of the current upper stage of the SpaceX megarocket. But, there is really no reason that other upper stages could not be developed for various tasks. I expect that the SuperHeavy first stage would be able to put a Mars lander with a return stage on the Martian surface, if someone wants to pay to do that. That is an entirely different proposition from having a single StarShip of current design fly the same mission. The use of multi-staging is actually the "proven" technology for such missions to the Moon, including the Apollo and Chinese missions with returns.