Let $f:X\longrightarrow S$ be a flat projective morphism of regular integral noetherian schemes such that that the generic fibre $X_\eta\longrightarrow K(S)$ is a smooth projective connected curve over $K(S)$.
Assumptions. For simplicity, let us assume that $S$ is one-dimensional, i.e., $S$ is a connected Dedekind scheme and that $K(S)$ is perfect. (I don't think we need these assumptions though.)
Let $\pi:S^\prime \longrightarrow S$ be a finite morphism of Dedekind schemes and suppose that there is a morphism $P:S^\prime\longrightarrow X$ of $S$-schemes, i.e., we have that $\pi = f\circ P$.
Question. Does the morphism $f:X\longrightarrow S$ factor through a flat projective morphism $X\longrightarrow S^\prime$ ?
Of course, this is not going to be true in general. So here's a better question.
Less precise question. If this is not true, can we ''explain'' when $f$ factors through $\pi$ and when not?
Unprecise question. Does a situation like the one above arise ''often''? Any references that might help?