Is a function $X \times Y \to Z$ continuous iff precomposition with continuous functions $X\to X\times Y$ and $Y\to X\times Y$ are continuous Is a function from a product space $X \times Y \to Z$ continuous if and only if  precomposition with all continuous functions $X\to X\times Y$ and $Y\to X\times Y$ are continuous? Clearly one direction holds for all spaces and I think I've shown that the other direction is true for functions $f:\mathbb{R}^n \to \mathbb{R}^m$ but I don't know if this is true generally or just true for nice enough spaces. Any counterexamples or special cases where this is true would be greatly appreciated.
Update: I have shown this is true if your base spaces are path connected or locally path connected metric spaces using the Tietze extension theorem but I still don't know if this is true generally. 
Update: In retrospect, this argument only really works for spaces where there are short enough paths between close points, such as a length space.
Suppose $X$ and $Y$ are path connected metric spaces. In metric spaces continuity is the same as sequential continuity. Take a convergent sequence $\{x_n\}$ and its limit $x_\infty$ in $X$ (or $Y$) and define a continuous map from $A=\{x_n\}\cup x_\infty$ to $\mathbb{R}$ which sends $x_n$ to $1/n$ and $x_\infty$ to 0. $A$ is a closed subset of $X$ so by the Tietze extension theorem it extends to a map $X\to \mathbb{R}$. Then given a convergent sequence $\{z_n\}$ which converges to $z_\infty$ in $X\times Y$ we can construct a map from $\{ \frac{1}{n}\} \cup 0$ to our sequence which sends $\frac{1}{n}$ to $z_n$ and extend it to a map from $[0, 1]$ to $X\times Y$ by connecting the paths between $z_n$ and $z_{n+1}$. We then extend that function to the entirety of $\mathbb{R}$, which when composed with our function $X \to \mathbb{R}$ gives us a continuous function which takes a convergent sequence in $X$ to a convergent sequence in $X\times Y$. If the image of the convergent sequence in $X$ under this map is convergent in $Z$, then the image of the convergent sequence in $X\times Y$ will also be convergent in $Z$.
 A: Let 

$$X=\Bbb R \text{ with the usual topology};$$ $$Y=\Bbb R \text{ with the cocountable topology };$$
$$Z=\Bbb R \text{ with the cofinite topology};$$
$$f:X\times Y\rightarrow Z$$
$$f(x,y)=
\begin{cases}
\frac{xy}{x^2+y^2},  & \text{if } (x,y)\neq(0,0) \\[2ex] 
0, & \text{if } (x,y)=(0,0) 
\end{cases}
$$

Then $f$ is not continuous, otherwise, $f$ restricted to the diagonal $\Delta$ of $X\times Y$ will be continuous. But $f(x,x)=\frac{1}{2}$ for $(x,x)\neq (0,0)$; Thus $(f|_{\Delta})^{-1}(\frac{1}{2})=\Delta \setminus \{(0,0)\}$, which is not closed in $\Delta$, though $\{\frac{1}{2}\}$ is closed in $Z$.
Lemma 1:

Every continuous function $g:\Bbb R \to \Bbb R_{\text{cocountable}}$ must be constant.

proof: $f(\Bbb Q)$ is countable, hence closed in $\Bbb R_{\text{cocountable}}$. $f^{-1}(f(\Bbb Q))$ is a closed set containing $\Bbb Q$, hence equal to $\Bbb R$. $f^{-1}(f(\Bbb Q))=\Bbb R$ implies $f(\Bbb R)=f(f^{-1}(f(\Bbb Q)))\subseteq f(\Bbb Q) $, hence $f(\Bbb R)$ is countable. A countable, connected subset of $\Bbb R_{\text{cocountable}}$ must be a one-point set. Hence $f$ is constant. $\square$
Claim 1:

For every continuous function $g: \Bbb R \to \Bbb R\times \Bbb R_{\text{cocountable}}$, the image must be contained in $\Bbb R\times \{y_0\}$ for some $y_0$. 

proof: $\pi_2\circ g$ is a continuous function from $\Bbb R$ to $\Bbb R_{\text{cocountable}}$. ($\pi_2$ is the projection onto the second coordinate). By lemma 1, $\pi_2\circ g$ is constant. Hence the result follows. $\square$
Hence for every continuous function $g: \Bbb R \to \Bbb R\times \Bbb R_{\text{cocountable}}$, the precomposition $f\circ g:\Bbb R\to \Bbb R_{\text{cofinite}}$ is equal to $f(x,y_0)=\frac{x^2y_0^2}{x^2+y_0^2}$ ($y_0$ fixed). Replacing $\Bbb R_{\text{cofinite}}$ by the finer topology $\Bbb R$, the function is easily seen to be continuous by standard calculus argument. Hence $f\circ g:\Bbb R\to \Bbb R_{\text{cofinite}}$ is continuous.
Lemma 2:

Every continuous function $h:\Bbb R_{\text{cocountable}} \to \Bbb R$ must be constant.

proof: (continuity on co-countable topology drhab's answer)  Let $h$ be such a function with e.g. $0,1\in h\left(\mathbb{R}\right)$. Suppose $f$ is continuous and let $D_0,D_1$ be disjoint open sets containing $0$ and $1$ respectively. 
Then $h^{-1}\left(D_0 \right)$ and
$h^{-1}\left(D_1\right)$ must be disjoint sets both
having a countable complement. Then $h^{-1}\left(D_0\right)$
as a subset of the complement of $h^{-1}\left(D_1\right)$
is countable and consequently $\mathbb{R}=h^{-1}\left(D_0 \right)\cup h^{-1}\left(D_0\right)^{c}$ is countable. Contradiction.
$\square$
Claim 2:

For every continuous function $h: \Bbb R_{\text{cocountable}} \to \Bbb R\times \Bbb R_{\text{cocountable}}$, the image must be contained in $\{x_0\}\times\Bbb R_{\text{cocountable}}$ for some $x_0$.

proof: $\pi_1\circ h$ is a continuous function from $\Bbb R_{\text{cocuntable}}$ to $\Bbb R$. ($\pi_1$ is the projection onto the first coordinate). By lemma 2, $\pi_1\circ h$ is constant. Hence the result follows. $\square$
Hence for every continuous function $h: \Bbb R_{\text{cocountable}} \to \Bbb R\times \Bbb R_{\text{cocountable}}$, the precomposition $f\circ h:\Bbb R_{\text{cocountable}}\to \Bbb R_{\text{cofinite}}$ is equal to $f(x_0,y)=\frac{x_0^2y^2}{x_0^2+y^2}$ ($x_0$ fixed). $(f\circ h)^{-1}(A)$ is closed (i.e. countable) for every closed (i.e. finite) set $A$. In fact, the preimage of each element can have cardinality at most $2$ (by looking at the $\text{graph}^1$). Hence $f\circ h:\Bbb R_{\text{cocountable}}\to \Bbb R_{\text{cofinite}}$ is continuous.

$^1$
