TITLE: Does the Doob-Dynkin lemma hold for any measurable space that separates points?
QUESTION [13 upvotes]: This is cross-posted from math.se, where I got no responses.
Let's say that a measurable space $(Z, \mathcal Z)$ has the "Doob-Dynkin property" iff for any set $X$, measurable space $(Y, \mathcal Y)$ and function $f:X\to Y$, a function $g:X\to Z$ is $f^{-1}(\mathcal Y)$ measurable if and only if it's a measurable function of $f$. This, with $\mathbb R$ playing the role of $Z$, is the Doob-Dynkin lemma as I was taught it.
It's easy to show that not every measure space has the Doob-Dynkin property. But let's say a separating measure space is one in which, given $x\ne y$, there exists a measurable set containing $x$ but not $y$.

Does every separating measure space have the Doob-Dynkin property?

I think I have a simple proof that this is the case when $f$ is surjective. Can this result be proven for a non-surjective $f$, or is there a counter-example?

Here's an outline of my proof.
First - with the above notation, if $g$ is $f^{-1}(\mathcal Y)$ measurable, and $Z$ separates points, then $g$ is a function (not necessarily measurable) of $f$. Proof: we only need to show that $f(x)=f(y)\implies g(x)=g(y)$, so let $x$ and $y$ be such that $f(x)=f(y)$. Then every set in $f^{-1}(\mathcal Y)$ either contains $x$ and $y$, or contains neither. If $g(x)\ne g(y)$, then let $A$ be some set of $\mathcal Z$ containing $g(x)$ but not $g(y)$. Then $g^{-1}(A)$ contains $x$ but not $y$ and so is not in $f^{-1}(\mathcal Y)$, thus $g$ is no measurable. Thus $g$ is a function of $f$, say $g=h\circ f$.
If $f$ is surjective then $h$ (which is unique when $f$ is surjective) is measurable. Proof: let $A\in \mathcal Z$. Since $g$ is $f^{-1}(\mathcal Y)$ measurable, $g^{-1}(A)=f^{-1}(B)$ for some $B\in\mathcal Y$. One can check that $h^{-1}(A)=B$.

REPLY [9 votes]: A characterization of spaces with the Doob-Dynkin property was given by N. Pintacuda in his paper Sul lemma di misurabilità di Doob (1989). Unfortunately, the paper is in Italian and it doesn't show up on Google. 
L. Pratelli gave another proof of Pintacuda's result in his paper Sur le lemme de mesurabilité de Doob (1990). You can find this paper (in French) here. His main result is the following (the translation from French is my own, and I changed the notation and terminology to match yours): 

Theorem: A measurable space $(Z, \mathcal{Z})$ has the Doob-Dynkin property if and only if it is separated and injective.

A measure space $(Z, \mathcal{Z})$ is said injective if for any space $(Y, \mathcal{Y})$ and any subset $A \subset Y$ (measurable or not), any measurable map from $A$ (with the subspace sigma algebra) to $Z$ can be extended to a measurable map from $Y$ to $Z$. 
The proof of the "if" part is essentially the one you gave, and the injectivity assumption is an ad hoc way to account for the fact that $f$ might not be surjective. You first prove that there exists a map $h: f(X) \to Z$ such that $g = h \circ f$. The author shows that this map is measurable if $f(X)$ is equipped with the subspace sigma algebra. By the injectivity of $Z$, it extends to a measurable map from $Y$ to $Z$. When $f$ is assumed surjective, the proof reduces to the one you gave.
Let's say that a space $Z$ has the weak Doob-Dynkin property if it has the Doob-Dynkin property with respect to surjective maps $f$. By the discussion above, a separated space has the weak Doob-Dynkin property. In fact, I believe that the converse also holds, i.e. a space has the weak Doob-Dynkin property if and only if it is separated.
Here is a sketch of a proof, which is essentially a minor modification of Proposition (1.1) in Pratelli's paper. Suppose $(Z, \mathcal{Z})$ has the weak Doob-Dynkin property. Take $X= Z$ and $g: Z \to Z$ the identity. Following Pratelli, consider the space $\tilde{Y}$ of maps $\mathcal{Z} \to \{ 0, 1\}$ and the map $\tilde{f}: Z \to \tilde{Y}$ that sends $x \in Z$ to the dirac measure $\delta_x: \mathcal{Z} \to \{0, 1 \}$. Equip $\tilde{Y}$ with the sigma algebra $\mathcal{A}$ generated by sets of the form
$$
A_{U,V} = \{ h: \mathcal{Z} \to \{ 0, 1 \} \; : \; h(U) \in V \}
$$
where $U$ ranges over $\mathcal{Z}$ and $V$ ranges over the power set of $\{0, 1 \}$. Now, let $Y \subset \tilde{Y}$ be the image of $\tilde{f}$, $f: Z \to Y$ be the restriction and $\mathcal{A}_Y$ be the subspace sigma algebra on $Y$. Then $f$ is surjective and one can check that it is measurable and strict, i.e. $f^{-1}(\mathcal{A}_Y) = \mathcal{Z}$ (this is Pratelli's terminology). 
By the Doob-Dynkin property, there is a measurable map $h: Y \to Z$ with $id_Z = h \circ f$. But this implies that $f$ injective. It is an easy check that this is equivalent to $Z$ being separated.
[1] MR1008597 Pintacuda, Nicolò. On Doob's measurability lemma. (Italian. English summary) Boll. Un. Mat. Ital. A (7) 3 (1989), no. 2, 237–241. 
[2] MR1071531 
Pratelli, Luca. 
Sur le lemme de mesurabilité de Doob. (French) [On Doob's measurability lemma] Séminaire de Probabilités, XXIV, 1988/89, 46–51,
Lecture Notes in Math., 1426, Springer, Berlin, 1990.