No, it wasn’t. The real world seldom has single causation. Some people supported Apollo as a messaging exercise. Most had other reasons.
And in any case, there are easy ways to demonstrate ICBM competence. Pyongyang isn’t going to the Moon to prove it can bomb Alaska.