The US military is more dependent on Musk than Musk is dependent on federal contracts. SpaceX, Starshield, Starlink - all absolutely a requirement in the current warfare environment. Threatening to nationalize Musk's companies only implies that they will devolve into NASA like structures, which means in the long run - destroying the ability of the US to project power. Given these empty threats - Musk holds all the cards in the Musk-Trump feud.
Also remember that most SpaceX launches are for Starlink satellites, not government launches