A great Lem's work dealing with metaphysic is Non serviam in his book A Perfect Vacuum.
(an extract)
(Personetics): A “world” for personoid “inhabitants” can be prepared in a couple of hours... A specific personoid activity serves as a triggering mechanism, setting in motion a production process that will gradually augment and define itself; in other words, the world surrounding these beings takes on an unequivocalness only in accordance with their own behavior... From four to seven personoids are optimal, at least for the development of speech and typical exploratory activity, and also for 'culturization’... It is possible to 'accommodate' up to one thousand personoids... Many different philosophies (ontologies and epistemologies) have arisen among them... I can enlarge their world or reduce it, speed up its time or slow it down, alter the mode and means of their perception; I can liquidate them, divide them, multiply them, transform the very ontological foundation of their existence...
Ahead, in the fictional review, the personoids argue between them about the existence an the believing in a "God", or a "Creator"; in this case, the scientist that programmed them.
I think this is one of the best metaphysical writings of Lem.