Here is how the function field version of Shafarevich's conjecture (=Arakelov-Parshin Theorem) implies that there are no elliptic curves or (at most) twice punctured rational curves in $M_g$:
(See Noam's comment to Felipe's answer)
Suppose there exists a smooth non-isotrivial family $f:X\to C$ of curves of genus $g$ for some fixed $g>1$ parametrized by a curve $C$. Call such a family admissible, let $m\in\mathbb N$ fixed and consider the set of numbers $$ D_m=\left\{ \deg (f_*\omega_{X/C}^m) \mid f \text{ is an admissible family } \right\} $$
By Shafarevich's conjecture (=Arakelov-Parshin Theorem) this set is finite and hence bounded for any given $m$. On the other hand, it is well-known that for $m\gg 0$ the line bundle $\det (f_*\omega_{X/C}^m)$ is ample, but we only need that it is not trivial and hence has a non-zero degree.
Now assume that $C$ admits an endomorphism of degree $>1$, say $\sigma:C\to C$. Then the base change $f_\sigma:X_\sigma\to C$ of any admissible family $f:X\to C$ is still admissible, but $$ \deg ({f_\sigma}_*\omega_{X_\sigma/C}^m) = \deg\sigma \cdot \deg (f_*\omega_{X/C}^m), $$ which would mean that if non-empty, then $D_m$ could not be bounded, therefore if $C$ admits such an endomorphism, then $D_m$ has to be empty.
If $C$ is an elliptic curve, or a rational curve minus (at most) two points, then it admits such an endomorphism, so they cannot parametrize smooth non-isotrivial families of curves of genus $>1$.
Remark
The boundedness of (the analogous set in arbitrary dimension) $D_m$ is sometimes called weak boundedness. The above argument shows that
"Weak Boundedness" implies "Hyperbolicity". This statement, in a somewhat more general form, is contained in Thm 0.8/0.9 of Logarithmic vanishing theorems and Arakelov-Parshin boundedness for singular varieties. Compositio Math. 131 (2002), no. 3, 291–317