Heinlein wasn’t the only one using the term when Space Cadet was published in 1948; Joseph Greene had already submitted a radio script with it in the title.
Wikipedia tries to explain:
“As Greene had submitted his radio script for “Tom Ranger and the Space Cadets” on January 16, 1946, prior to Robert A. Heinlein’s 1948 Space Cadet but Heinlein influenced the evolution of “Tom Ranger” into “Tom Corbett” and launched his student astronaut title’s common mention, they share credit for the popularity of both formal and later slang uses of “space cadet…
The Tom Corbett, Space Cadet television series and radio show made “space cadet” a household phrase. By 1955, Jackie Gleason spoke the phrase on The Honeymooners television show in an episode called ‘TV or not to TV’, original air date October 1st, 1955.
The popular meanings of “space cadet” later shifted in popular culture away from astronaut-in-training to indicate, by the 1960s, an “eccentric person disconnected with reality” (often implying an intimacy with hallucinogenic drugs) although by the 2010s, drug abuse was rarely implied by this phrase, nor was low intelligence implied; “space cadet” was more simply associated with “spacing out,” wandering from present concerns, especially of others present, and being a “space case” with its alliterative rhyme. Both the “trainee astronaut” and “person regarded as being out of touch with reality” entered the Oxford Dictionary for English language, though by 2014 Oxford notes that in American English, the phrase had also recouped the positive connotations originally meant by Heinlein and Joseph Greene, the Tom Corbett, Space Cadet writer: ‘An enthusiast for space travel, typically a young person.'”