Its not just a matter of power and know-how...but of aspiration, vision, and heart.
Great civilizations can survive a lot of things, but not impoverishment of spirit.
He may be right, that the space race offered civilization something toward which we should strive, that enhances our spirit. However, from my perspective this 50th Anniversary of the Mooon walk has conjured up all sorts of New Deal light statism in the ranks of usually Deplorable stock. That is, typically Constitutional conservatives are looking wistfully at the 1960s-era govt-run space program (and if someone can explain the Constituional basis for NASA or the FAA I'd love to hear about it...and please do not say "the Commerce Clause"), where we beat the Soviets to the Moon, and want to revive the old-time statist spirit to Go to Mars.
Maybe, just maybe, mankind got over their romance with space flight in the 1970s because we had Better Things To Do...like defeat Communism. Sure, the Moon shot helped give America a shot in the arm after Sputnik, but we lost all of that spirit until Reagan got us back on track.
It is the same situation today...the loss of spirit needn't be re-discovered in the stars or Mars of Elon Musk, but on Earth...in America...in defeating Antifa/statism/tyranny/collectivism/anti-God threat of the Deep State. That will require a much more challenging changing of hearts and minds vs living on Mars.
...which, ironically given Kennedy's words, is why so many people LOVE the idea of going to Mars... because it IS easier than changing hearts and minds. But they payoff of converting a bunch of Dems and centrists (and maybe a few MSNBC-types) to Deplorables is outta this world.