Let $(\Omega,\mathcal A,\operatorname P)$ be a probability space, $d\in\mathbb N$, $X$ be a $\mathbb R^d$-valued random variable on $(\Omega,\mathcal A,\operatorname P)$, $Y$ be a $\left\{0,1\right\}$-valued random variable on $(\Omega,\mathcal A,\operatorname P)$, $\eta$ be a version of $\operatorname P\left[Y=1\mid X=\;\cdot\;\right]$ and $f:\mathbb R^d\to\mathbb R$ be Borel measurable.
How can we show that $\operatorname E\left[\left|\eta(X)-Y\right|^2\right]\le\operatorname E\left[\left|f(X)-Y\right|^2\right]$?
If $f$ is bounded, then $$\operatorname E\left[(f(X)-\eta(X))(\eta(X)-Y)\mid X\right]=(f(X)-\eta(X))\operatorname E\left[\eta(X)-Y\mid X\right]\tag1.$$ Thus, in that case, we may note that $$|f(X)-Y|^2=|f(X)-\eta(X)|^2+2(f(X)-\eta(X))(\eta(X)-Y)+|\eta(X)-Y|^2\tag2$$ and hence \begin{equation}\begin{split}\operatorname E\left[|f(X)-Y|^2\mid X\right]&=|f(X)-\eta(X)|^2+2(f(X)-\eta(X))\underbrace{(\eta(X)-\operatorname E\left[Y\mid X\right])}_{=\:0}+\operatorname E\left[|\eta(X)-Y|^2\mid X\right]\\&\ge\operatorname E\left[|\eta(X)-Y|^2\mid X\right].\end{split}\tag3\end{equation} Building expectation, we obtain the claim.
How can we generalize this result?
Clearly, we need to invoke the monotone convergence somehow.
If $E([f(X)-Y]^2)=\infty$ the inequality is trivial. Otherwise, $f(X)-Y\in L^2$. Since $Y$ is bounded, $Y\in L^2$, thus $f(X)=[f(X)-Y]+Y \in L^2$.
Since $|\eta(X)|=|E(Y|X)|\leq 1$, we have $f(X)-\eta(X)\in L^2$ and all the summands in the RHS of $(2)$ have finite expectation, so the proof is still valid.