Let $X$ and $Y$ be two random variables taking values in $(E,\mathcal{E})$ and $(F,\mathcal{F})$, respectively, such that the conditional law of $Y$ given $X$ exists, denoted $\mathrm{P}_{Y|X}$. That is to say, for all $g\colon F \to \mathbb{R}_+$ measurable,
$$\mathrm{E}[g(Y)|X] = \int_{F} g(y) \mathrm{P}_{Y|X}(\mathrm{d}y)~.$$
Now, is it always true that if $h\colon E \times F \to \mathbb{R}_+$ is measurable, then $$\mathrm{E}[h(X,Y)|X] = \int_{F} h(X,y) \mathrm{P}_{Y|X}(\mathrm{d}y)~?$$
I know that it is the case for variables with densities (using Fubini's theorem, $\mathrm{P}_{Y|X}$ can actually be deduced from the joint density), or if $X$ is discrete (i.e. $E$ is countable). What about the general case?
Actually one also have to check that the function we defined is $\sigma(X)$-measurable. Let then $$H = \Big\{h\colon E\times F \to \mathbb{R}_+ \Big| \: x \mapsto \int_F h(x,y) \mathrm{P}_{Y|X=x}(\mathrm{d}y) \text{ is $\mathcal{E}$-measurable}, \\ \text{ and } \mathrm{E}[h(X,Y)|X] = \int_F h(X,y) \mathrm{P}_{Y|X}(\mathrm{d}y) \Big\}~.$$
Let us first show that $H$ contains all simple functions. To this end, let $\mathcal{C} = \{ C \in \mathcal{E} \otimes \mathcal{F} | 1_{C} \in H \}$. We have:
Altogether, $\mathcal{C}$ is a Dynkin system containing the rectangles, and by the $\pi$-$\lambda$ theorem, $\mathcal{C} = \mathcal{E} \otimes \mathcal{F}$.
It is now very easy to conclude that $H$ contains all positive measurable functions on $E \times F$, using the exact same third argument above.