The result is true under the stability hypothesis. Here's a sketch of the proof. Let us consider the derivative $d\varphi$ as a section of the vector bundle $T^*_X\otimes_{\mathbb R}\varphi^*T_{X'}$ on $X$. Using the complex structures on $X,X'$, we can consider its antilinear part $\bar\partial\varphi\in\Gamma(X,\Omega^{0,1}_X\otimes_{\mathbb C}\varphi^*T_{X'})$. We now make the key observation that $\bar\partial\varphi$ is in fact a section of the subbundle $\pi^*\Omega^{0,1}_Y\otimes_{\mathbb C} \varphi^*T_{X'/Y}$, where we use the notation $T_{X'/Y}$ to denote the bundle of vertical vectors in $X'$ over $Y$.
This is easiest to see using a local coordinate representation of $\varphi$ of the form $(z_1,\ldots,z_n,w)\mapsto(Z_1,\ldots,Z_n,W)= (z_1,\ldots,z_n,g(z_1,\ldots,z_n,w))$, and using the fact that $g$ is holomorphic in $w$. In our local coordinate system, $\bar\partial\varphi = \sum_{j=1}^n\frac{\partial g}{\partial \bar z_j}d\bar z_j\otimes\frac{\partial}{\partial W}$.
It now follows that if we restrict $\bar\partial\varphi$ to any fibre $X_y$
(for some $y\in Y$), we get a section of the vector bundle $\Omega^{0,1}_{Y,y}\otimes_{\mathbb C}\varphi^*{T_{X'_y}}\to X_y$ with the following properties: it is holomorphic and vanishes on the marked points $s_1(z),\ldots,s_m(z)$. By the stability assumption, it now follows that $\bar\partial\varphi=0$, which completes the proof that $\varphi$ is holomorphic.
As pointed out in the comments, if we relax stability, we need not have the result. For example take $X = \mathbb C\times\mathbb C/\Gamma = X'$ where $\Gamma\subset\mathbb C$ is a lattice, and let $\varphi(z,w) = (z,w+|z|^2)$. This is fibrewise holomorphic, but not holomorphic overall. We can see that $\bar\partial\varphi = z\,d\bar z\otimes\frac{\partial}{\partial w}$, and this gives a holomorphic vector field on each fibre (when we drop $d\bar z$).