This is a non-issue. In times of war government can simply nationalize the company. They did it in 1st war world with rails companies (https://en.wikipedia.org/wiki/Railway_nationalization) and that was a harsh lesson for those companies when 2nd war world came around - they got their act together so no such act was necessary anymore.
Pretty sure if SpaceX does not fully complies with government demands in times of war, it will suddenly be a subsidiary of NASA.