Another approach is applicable if you already have some function, say s, and you do not the process that generated it.
s = Nest[1 + x^n (#) &, 1, 3] z = 1 + x^n (1 + x^n (1 + x^n)) Use ReplacePart with Map(/@)
ReplacePart[z, Position[z, n][[#]] -> Defer@# & /@ Range[3]] If you do not want x^1 drop Defer.

