Let $\tau: E \to E$ be a measure-preserving transformation of the measure space $(E, \mathcal{E}, \mu)$, i.e. $\mu(\tau^{-1}(A)) = \mu(A)$ for all $A \in \mathcal{E}$. Let $\mathcal{E}_\tau = \{ A \in \mathcal{E} : \tau^{-1}(A) = A \}$. In my lecture notes, it is claimed that a measurable function $f$ is invariant (i.e. $f \circ \tau = f$) if and only if it is measurable with respect to $\mathcal{E}_\tau$.
This is evidently false: Let $E = \{ 0, 1 \}$, and let $\mathcal{E} = \mathcal{P}(E)$ be the power set. Let $\mu$ be the uniform distribution. Let $\tau$ act on $E$ by transposing 0 and 1. Let $f: (E, \mathcal{E}) \to (E, \mathcal{E}_\tau)$ be the identity map on $E$. Clearly, $f$ is measurable and not invariant. Yet it's also measurable with respect to $\mathcal{E}_\tau$: the preimage of every measurable set in its codomain is in $\mathcal{E}_\tau$, by construction.
Have I misinterpreted the claim? If not, is there a similar claim which is true, e.g. by fixing the codomain of $f$?