Here is where I believe I went wrong.
The correctness of the statement depends on what is meant by "with residue field $k$".
If "with residue field $k$" means "with a residue field isomorphic, as a field, to $k$", then the statement is incorrect. In this interpretation, the case when $X$ and $Y$ are spectra a fields reduces to:
If $K \subset L \subset M$ are fields and $K \cong M$, then $K \cong L$.
and this is false.
However, if "with residue field $k$" means "with residue field, viewed as a field over $k$, equal to $k$", then the statement is correct. In this interpretation, the case when $X$ and $Y$ are spectra of fields reduces to:
If $K \subset L \subset M$ are fields and $K = M$, then $K = L$.
which is trivially true.
But the second interpretation is the more natural in this context. The statement is about a morphism over $k$, so we should interpret the entire statement as being "over $k$".