Let $(\Omega, \mathcal{F}, P)$ be a probability space with random variables $X,Y$ defined on it. Let $\mathcal{M} \subset \mathcal{F}$ be a sub-$\sigma$-algebra. Suppose that $X$ is $\mathcal{M}$-measurable and that $Y$ is independent of $\mathcal{M}$. Let $Z=g(X,Y)$ for some Borel $g:\mathbb{R}^2 \to \mathbb{R}$. Assume $X,Y,Z \in L^1$. I'd like to show that $\mathbb{E}[Z|\mathcal{M}] = \phi(X)$ where $\phi(x)=\mathbb{E}[g(x,Y)]$?
I've tried doing the usual trick of indicator-simple function-MCT, but I wasn't quite able to make it work. Using Fubini's theorem we can show that $\mathbb{E}[\phi(X)] = \mathbb{E}[g(X,Y)]$. Indeed, by the independence of $X,Y$, their joint law is exactly the product measure of their individual laws, and also we have that $\mathbb{E}[g(X,Y)] = \iint_{\mathbb{R}^2} g(x,y) (\mu_{1} \times \mu_{2})(dx\ dy) $ whereas $\mathbb{E}[\phi(X)] = \int_{\mathbb{R}} \left( \int_{\mathbb{R}} g(x,y) \mu_{2}(dy) \right) d\mu_{1}(dx)$ so the result follows from Fubini. But we need to show $\mathbb{E}[\mathbf{1}_{H}\phi(X)] = \mathbb{E}[\mathbf{1}_{H}g(X,Y)]$ for all $H \in \mathcal{M}$ and it's not obvious to me how to extend the argument.
UPDATE: We may note that by this, it is possible to assume WLOG that $\mathcal{M}=\sigma(X)$.