You could only think Heinlein had militaristic views if that was the only book of his you read.

Read another book of his and you'd think he was a communist, another an anarchist, et cetera.

He liked to explore ideas. If there's one thing that's reasonably consistent across his work, it's his belief in individual agency.