Two approaches with Replacement.
z = Nest[1 + x^n (#) &, 1, 3] ReplacePart[z, Position[z, n][[#]] -> Defer@# & /@ Range[3]] Also inspired by the @Karsten7's answer and @Eldo's Module version:
Module[{r = 3, i = 1}, Quiet@ReplaceRepeated[(1 + x^n), (1 + x^n) -> 1 + x^n (1 + x^n), MaxIterations -> r - 1] /. n :> i++]
1 + x (1 + x^2 (1 + x^3))
