Comment of the Day: Erik Lund: The Robert Heinlein Wars, Part MDCCLXIV: Hoisted from 2006: "It's pointless to read Heinlein through a political lens. He was a narcissist; it's all about him...
...Starship Troopers was written for Heinlein's Scribner's contract. He was supposed to produce an annual juvenile novel for the Christmas season. The novel was written in a hurry, submitted too late for editorial revision, and rejected by his long-time editor, Alice Dalgleish, sometimes mischaracterised as a blue-stocking prude. (Well, I suppose she could have been; LGBTQs can be prudes, after all.)
With the rejection, Heinlein was free to shop Starship Troopers around. Later, he characterised this as his plan, all along. He was tired of juveniles. (Except that he returned to the well with Putnam in Podkayne in 1963.)
So what else might have been going on in Heinlein's mind? Many of Heinlein's early books were dedicated to family members; but ST is dedicated to a a crazy guy who was lobbying to get the United States to redeclare war on North Korea and save his son from the sekrit Commie prison camp he was sure the boy was in. (You may recall this as a background point in the novel, as well.) The dedication describes this man as a "true" father.
Speaking of fathers, Rex Ivar Heinlein died on 9 November 1959, in Los Angeles. I believe that he was living with one of his three daughters at the time, although I haven't been able to confirm that for this post.
The timing would lead me to think that Heinlein was working through his issues with his father when he wrote ST, and the results, when you consider the role that Johnny Rico's father plays in the novel, are not pretty. Very little about Heinlein's private life is.