Let $X$ and $Y$ be 2 random variables such that $X\sim Y$ and $E[Y|X]=X$ almost surely. Is it true that $X=Y$ almost surely?
This is true in the Gaussian case and I was wondering if it was true in general.
EDIT: I think I got it if $X$ and $Y$ are $L^2$, can someone confirm?
\begin{align*} E[(Y-X)^2] &= E[Y^2]-2E[YX]+E[X^2]\\ &= E[Y^2]-2E[E[YX|X]]+E[X^2]\\ &=E[Y^2]-E[X^2]\\ &=0 \end{align*}
Hence $X=Y$ a.s.
What about $L^1$ ?
Here is an argument based on the idea of @mathex's answer.:
Proof of Lemma. We only prove the first part. Let $Z = X \wedge k - \mathbf{E}[Y\wedge k\mid X\wedge k]$. Then
$$ \mathbf{E}[Z] = \mathbf{E}[X \wedge k] - \mathbf{E}[Y \wedge k] = 0. $$
So it suffices to prove that $Z \geq 0$. However, this follows from
\begin{align*} \mathbf{E}[Y\wedge k\mid X\wedge k] &\leq \mathbf{E}[Y\mid X\wedge k]\wedge k \tag{$\because$ Jensen} \\ &= \mathbf{E}[\mathbf{E}[Y\mid X]\mid X\wedge k]\wedge k \\ &= \mathbf{E}[X\mid X\wedge k]\wedge k \\ &= X \wedge k, \end{align*}
completing the proof of the lemma. $\square$
Now we return to the original question. By the lemma, for any $n \geq 1$ and with the truncation function
$$ f_n(x) = (-n) \vee (x \wedge n) = \begin{cases} -n, & x < -n \\ x, & -n \leq x \leq n, \\ n, & x > n \end{cases} $$
we get $\mathbf{E}[f_n(Y) \mid f_n(X)] = f_n(X)$. Since $f_n(X)$ and $f_n(Y)$ are bounded, arguing as in OP, we get
$$f_n(X) = f_n(Y).$$
Now we conclude by letting $n \to \infty$.