In 2023 SpaceX launched commercial (in other words excluding experimental/starship stuff) 96 times including 7 times for NASA. NASA played a critical role in SpaceX's early founding, where their first contract with NASA is effectively what enabled the company to exist. But I would also emphasize that such wasn't just serendipity. SpaceX's entire initial concept was built around said NASA contract, because it existed. If it didn't then they obviously would have been pitching to e.g. telecoms companies or whatever. But since then they've increasingly just become another customer, though certainly a VIP customer!
As for talent, launching stuff is not really NASA's competency in modern times. After the Space Shuttle was retired in 2011 until SpaceX entered the picture in 2020, the one and only way we got to the ISS was by relying on Russia. The SLS [2] was NASA's effort at creating a new launch vessel and it's just been a complete failure that was already been obsoleted by the Falcon Heavy years ago. SLS's expected cost per flight is $2billion+. So you're looking at up to twice the theoretic payload for 20x+ the cost. If not for corruption/graft, that rocket would have long since been cancelled and would certainly never fly a single mission. And I'm completely ignoring Starship here!
Also I doubt these companies would be as numerous or as big without the promise of fat government contracts looming on the horizon.