While Replacement is needed to prove that long ordinals exist, it is not needed to prove that long well-orderings exist. The usual proof of Goodstein's theorem just needs the well-foundedness of a particular relation $R$ on the naturals (which happens to classically have ordertype $\epsilon_0$). Meanwhile, $\mathsf{Z}$ contains $\Pi^1_1$-$\mathsf{CA}_0$, and the latter theory is more than enough to show this. (In fact all we need for a quick proof is $\mathsf{ATR}_0$, but that "feels replacement-y" - I think it's easier to convince yourself that $\mathsf{Z}\vdash\Pi^1_1$-$\mathsf{CA}_0$ and then that $\Pi^1_1$-$\mathsf{CA}_0$ proves that (the usual primitive recursive relation for) $\epsilon_0$ is well-founded.