Suppose $X$ is a compact Hausdorff space, $Y$ is a compact $T_1$ space and $f\colon X\to Y$ has the property that for every $T_3$ space $Z$ and every continuous $g\colon Y\to Z$, the composition $g\circ f$ is continuous.
Can we conclude that $f$ itself is continuous?
If $Y$ was allowed to be more pathological, the answer would no: for example, if we take for $Y$ the Sierpiński two-point space (which is compact and $T_0$), then any continuous function from $Y$ to a $T_3$ (even $T_1$) space is constant, so the assumption is trivially satisfied for any function $f$, which means that in particular, we can take an $f$ which maps a non-closed set to the closed point, and its complement to the open point, and then the conclusion fails.
The answer is no.
Consider $X=[0,1]$ and $Y=([-1,1]\times \{0,1\})/{\sim}$, where $(x,i)\sim (x',i')$ iff $(x,i)=(x',i')$ or $x=x'<0$ (i.e. $Y$ is a double-ended interval with "loose threads" hanging off the twin ends). Put $f\colon X\to Y$ as $0\mapsto (0,1)$, and $x\mapsto (x,0)$ when $x>0$.
Then $f$ is clearly not continuous at $0$, but if we compose it with any function into a Hausdorff space, we will obtain a continuous function (because any continuous function from $Y$ to a Hausdorff space will glue $(0,0)$ and $(0,1)$ together).