The assumption that $Y$ is countably separated cannot be meaningfully weakened. The following is Proposition 2.1 of [Musial, Kazimierz. "Projective limits of perfect measure spaces." Fund. Math 110.163-188 (1980).]:
Let $(X,\mathcal{X})$ and $(Y,\mathcal{Y})$ be measurable spaces and $f:X\to Y$ a measurable function. Then the graph of $f$ is measurable in the product $\sigma$-algebra if and only if there exists a countably generated sub-$\sigma$-algebra of $\mathcal{C}$$\mathcal{Y}$ that contains all points of $f(X)$.