I think that the authoritative Introduction by Edward Rosen to his translation with commentary of :
can give us the necessary informations.
It seems quite clear that the booklet was not intended to be a sci-fi novel at all.
The origin is in the draft of Kepler's dissertation of 1593 on the motions of the moon [page xvii]
Kepler refers to it as his Lunar Astronomy [page xviii] and around 1609 he
constructed the framework of the Dream [...] in order to introduce a supernatural agency for the purpose of transporting a professional astronomical observer to the moon [page xix].
In 1629 Kepler mentioned his "Astronomy of the Moon or of the Celestial Phenomena as seen from the Moon" as a possible choice for a
mathematical textbook suitable for use in the classroom [page xx-xxi].
The posthumous book was published in 1631 by Kepler's son [page xxi].
According to reference into Rosen's introduction, the first reactions to the book judged it bizarre or satyrical [page xxiii].
Browsing Kepler's notes, we can see [page 68] clear discussion of celestial phenomena, with reference to Aristotle as well as Kepler's own Epitome of Copernican Astronomy.
Kepler published during his life several books explicitly copernicans; thus, I do not think that the "narrative form" was due to the necessity of concealing his ideas [see Addendum].
In addition, the idea of extra-terrestrial life does not seem to be a key fature of the book.
The "narrative form" of the book must be understood in the Renaissance and Humanists context, with reference to Erasmus, Thomas More and Campanella and their Utopia's as well as Plutarch's treatise "On the Face Which Appears in the Orb of the Moon" (Περὶ τοῦ ἐμφαινομένου προσώπου τῷ κύκλῳ τῆς σελήνης - De facie in orbe lunae), included into the collection of 78 essays and transcribed speeches named Moralia (Ancient Greek : Ethika).
Kepler's notes refer also to True History (Ancient Greek: Ἀληθῆ διηγήματα) the a parody of travel tales by the Greek-speaking Syrian author Lucian of Samosata and to Ignatius His Conclave (Latin: Conclave ignati) published anonymously in 1611 (and thus, presumibly, Kepler was unaware of the name of the author) by the metaphysical poet John Donne.
We must be aware that this "strange" book was drafted in a time when there was not yet a clearcut division between science, philosophy, humanities ...
Note : for a book-lenght analysis of :
Johannes Kepler’s Somnium, [as] a work heavily indebted to the Neoplatonist cosmological allegory as a literary form
Some chronology can help :
Copernicus, De revolutionisbis : published 1543; in March 1616, the Roman Catholic Church's Congregation of the Index issued a decree suspending De revolutionibus until it could be "corrected"
Kepler, Epitome astronomiae Copernicanae : published in three parts from 1618–1621
Kelper died : 1630
Descartes, Le Monde : written between 1629 and 1633
Galileo, Dialogo : published 1632
Galileo found "vehemently suspect of heresy" and condemned : 1633
Descartes' decision to not to release Le Monde upon news of the conviction of Galileo : 1633
Kepler's Somnium : published 1634
My conclusion is that the chronology does not support the hypotheses that Kepler's decision not to publish the Somnium was due to the condemnation of Copericanism.