Why should $\varphi$ have dense image for the composition of rational maps $\varphi \circ \psi$ to be defined? This is regarding a remark from Shafarevich's Basic Algebraic Geometry-1, I am quoting for everyone's convenience:

Given two rational maps $\varphi:X\rightarrow Y$ and $\psi:Y\rightarrow Z$, such that $\varphi(X)$ is dense in $Y$ then it is easy to see that we can define a composite $\psi \circ \varphi:X\rightarrow Z$; if in addition $\psi(Y)$ is dense in $Z$ then so is $(\psi \circ \varphi)(X)$.

Here $X$, $Y$, and $Z$ are considered to be irreducible algebraic sets.
My question is: Why is the condition that $\varphi(X)$ be dense in $Y$ necessary?
Consider $X=Y=Z=\mathbb A^2$, and $\varphi(x,y)=(x/y,0)$ and $\psi=\textrm{identity}$. $\varphi$ does not have dense image yet the composition is defined.
Edit:
I think for $\psi \circ \varphi:X\rightarrow Z$ to be a rational function it is sufficient if $\varphi(X)$ does not have empty intersection with $V$ where $V \subseteq Y$ is the domain of definition of $Y$. Is my claim correct? Because if the condition I require is satisfied then $\psi \circ \varphi$ is defined for at least one point and therefore has an open set of $X$ as its domain of definition. I think the requirement of denseness is required to define $\varphi^*$ and the subsequent eqauality $(\psi \circ \varphi)^*=\varphi^*\circ \psi^*$.

What if $\phi(x,y)=(x,0)$ and $\psi(x,y)=(0,1/y)$?
Here, again, $X=Y=Z=\Bbb A^2$.
