The biggest problem NASA has is they operate under the whims of the US government, while SpaceX doesn't.
Space research and operations require very long-term planning, you can't change direction every 4 years, just because a new president has different ideas than the previous one, it's already a miracle that NASA has been able to do what they're doing in this awful conditions.
No wonder SpaceX took over. It's not NASA's fault but the US government.