Why do $\pi$ and $\bigcup$ commute for Gödel-closed extensional classes? Jech exercise 13.3 states:

If $M$ is closed under Gödel operations and extensional, and $\pi$ is the transitive collapse of $M$, then $\pi(G_i(X,Y))=G_i(\pi X,\pi Y)$ for all $i=1,\ldots,10$ and all $X$, $Y\in M$.

I'm able to show this for the first 5 Gödel operations ($\{X,Y\}$, $X\times Y$, $\varepsilon(X,Y)$, $X-Y$, and $X\cap Y$), but I'm a little stuck on $G_6(X)=\bigcup X$. I can see that the problem is essentially equivalent to showing that
$$\left(\bigcup X\right)^M=\bigcup X,$$
as then $\pi(\bigcup X)=\pi((\bigcup X)^M)=(\bigcup\pi X)^{\pi M}=\bigcup\pi X$ since $\bigcup$ is a $\Delta_0$ operation and $\pi X$ is transitive.
The problem is that $M$ is not generally transitive, so the $\Delta_0$ observation doesn't help on that side, and I don't see any other reason why the equation above should be true.  I don't even see a reason to believe that $(\bigcup X)^M$ exists!
Since $M$ is extensional, it is enough to show that $M\cap(\bigcup X)^M=M\cap\bigcup(M\cap X)=M\cap\bigcup X$, but again, why should that be true?
I've already checked Frédéric Wang's solutions and Monk's notes. The former don't address this case at all, and the latter seems to implicitly assume that $M$ is transitive, though I may be missing something.
I anticipate problems with the remaining operations for similar reasons, so I hope that clarity on this one resolves the rest.
(Even if this turns out to be false, I doubt it affects anything of note. In most cases of interest (or so it seems), $M$ is an elementary submodel of $L_\delta$ (or similar), and in those cases $\bigcup$ is a defined notion, hence absolute between $M$ and $L_\delta$.)
 A: Here is what I wrote when I solved this problem a few years ago:
As $M$ is extensional, the transitive collapse is an isomorphism.  The statement $C=G_i(A,B)$ can be expressed by a $\Delta_0$ formula $\phi_i(A,B,C)$.  If we assume that these operations are absolute for extensional classes, then $Z=G_i(X,Y)$ if and only if $V\models \phi_i[X,Y,Z]$, if and only if $M\models \phi_i[X,Y,Z]$, if and only if $\pi(M)\models \phi_i[\pi(X),\pi(Y),\pi(Z)]$, if and only if $V\models \phi_i[\pi(X),\pi(Y),\pi(Z)]$, if and only if $\pi(Z)=G_i(\pi(X),\pi(Y))$.
So it suffices to show that these $\Delta_0$ formulas are absolute not only for transitive classes, but extensional classes closed under the Gödel operations.  Note that once we show that the given sets satisfy the conditions, extensionality proves that they are the unique set satisfying the condition.
$\phi_6[X]$ is
$$
(\forall z\in Z, \exists x\in X,\, z\in x)\land (\forall x\in X,\, \forall u\in x,\, u\in Z).
$$
The set $\bigcup X$ clearly satisfies the second conjunct in $M$, and we will show the other.  Let $z\in \left(\bigcup X\right)\cap M$.  As $M$ is closed under the operations, it contains the two distinct sets $G_3(\bigcup X-\{z\},X)$ and $G_3(\bigcup X,X)$.  By extensionality, there exists some ordered pair $(z,x)\in \left(\left(\bigcup X\right)\times X\right)\cap M$ with $z\in x$.  Hence, by the previous exercise $x\in M$.
