You are very wrong about this actually.

SpaceX funded most of the Falcon 1 program themselves. The DoD was one early costumer.

SpaceX got some funding for Commercial Cargo program but that was mostly for the capsule, it didn't fully fund the Falcon 9.

The whole Falcon 9 improvement, such as Merlin 1D engines and all the other improvements were funded from SpaceX themselves.

The same goes for the complete SpaceX re-usabilitly program.

Under the Commercial Cargo contract part of that money was for human rating the Falcon 9 but is mostly about paper work and certification. A few issues were addressed that were financed with this contract. That money was for the capsule.

The Raptor program was a SpaceX own development. They got a small grant from the air force for a small Raptor version but that is a tiny part of the program and the current Raptor is very different. All of that was done without any funding from government.

The complete Starship program was funded by SpaceX themselves until last year when they got comparatively small amount for the Starship as a Moon lander study, but not nearly enough to fund the program.

The complete Starlink program was funded and developed by SpaceX without any government contracts.

Its flat out false to say that everything SpaceX has done was government funded. SpaceX has and had many commercial flights and has multiple rounds of investment of private money raised.

In reality SpaceX very likely bit to low for both CRS and for CommercialCrew. SpaceX had to invest private funds to get these programs operational. Boeing considered SpaceX bid so low that it would be impossible for SpaceX to finish the capsule and reasoned that when that happened they could also ask for more money, but SpaceX didn't ask for more money and finished the project.

And the argument that it all builds on decades of NASA engineering effort, well that is partly true. But you could just as well argue that Space build on all engineering effort of humanity.

NASA or its contractors have never even come close to making an engine so operationally cheap as the Merlin, or an engine that was as reusable as Merlin. Nothing NASA has ever done is close to as impressive as Raptor (RS-25 is neat design but production and cost nightmare). NASA has not build a cargo or crew capsule in 50 years. NASA has not managed to design a new rocket in 50+ years. NASA own attempts at rocket development have universally failed.

NASA never managed anything close to capturing a reusable orbital booster. Programs like DC-X are not in the same league.

People need to stop claiming that SpaceX is simply a couple guys who found some drawings at NASA and said, he we can copy that. SpaceX has done things NASA was not able to even with budgets 10-50 times higher. Most of the things SpaceX profited from were done decades ago.

And in the opposite direction it is actually the case that NASA learned a huge amount from SpaceX as well. NASA got full access into Space re-usability program like the engines, super-sonic retro-propulsion. SpaceX has the first data on pusher escape systems. Full-Flow Stage Combustion engine are now something NASA can study because of the Moon Lander program. SpaceX way of doing software development have very much changed NASA approchs as well.

And all of that is before we consider the organizational changes at NASA that happened directly because of SpaceX. Many NASA engineers have talked about how contact with SpaceX directly changed their perspective and how they tried to bring this culture into NASA. Dan Rasky is one good example of this, his talks on the subject are informative.

What makes SpaceX (and in a different way BlueOrigin) different is exactly that they go and get their own funding for when they want to work on a project. If government has some contracts open that they can use their technology for they are happy to do it. Eventually government will fly regularly with Starship, but that is different from SpaceX Starship program being funded by government.