It seems to me that in the global case the answer should be $no$ because of the following argument.

Set $S:=Spec$ $k[x,y,z]/(z^2-xy)$. Then $S$ is isomorphic to a quadric cone in $\mathbb{A}^3$. The point is that there are plenty of smooth double covers of $S$, which are pairwise non-isomorphic.

To see this, notice first that the morphism $f \colon \mathbb{A}^2 \to S$ corresponds to the restriction of a double cover $\mathbb{P}^2 \to$ (Cone $\subset \mathbb{P}^3$) branched on the vertex of the cone and on a smooth conic contained in the hyperplane at infinity.

Now one can generalize this construction by taking a double cover $f_k \colon Y_k \to S$ which is the restriction to $S$ of the projective cover branched on the vertex and on a smooth curve of $even$ degree $2k$ not passing through the vertex. The fact that $f_k$ is branched at the vertex ensures that $Y_k$ is smooth.

When $k=1$ we have $Y_1=\mathbb{A}^2$.

When $k=2$, $Y_2$ is an affine, open subset of a smooth surface of general type with $p_g=4, q=0, K^2=5$. These surfaces were studied by Horikawa in his famous paper "On deformations of quintic surfaces"; it turns out that the projective double cover is actually the canonical map.

Of course $f_2$ does not factor through $f$, since they are covering of the same degree but $Y_2$, being of general type, is not isomorphic to $\mathbb{A}^2$.

In fact, $f_k$ does not factor through $f$ except for $k=1$.