Given a random variable $X$, can any random variable $Y$ be "decomposed" as a function of $X$ and $Z$ independent of $X$? I want to know if given a random variable $X$ on some measure space $(\Omega, \mathscr M, P)$, can any random variable $Y$ on the same measure space be "decomposed" as a function of $X$ and an r.v. $Z$ (again on $\Omega$)  independent of $X$, i.e. $Y= f(X,Z)$ (for I gues some measurable $f$)?
The reason I ask is because I was again thinking on my old question Conditional expectation $\mathbb E(Y \mid X \in B)$ instead of $\mathbb E(Y \,|\, X = x)$ (generalization of Shorack's PFS Notation 7.4.1), and came across this comment in  Probability, conditional on a zero probability event, which presents a scenario in which conditioning on $X=x$ makes complete sense: for $Y:= Z+X$ for some independent r.v.'s $X,Z$ uniform $(0,1$), we have $P(Z+X > 1.5 | X = 0.8) = P(Z+0.8>1.5) = P(Z>0.7)=0.3$, i.e. we plug in $X=0.8$ to $Z+X$ and then evaluate the probability in a very straightforward way.
Thus although it is true in general that conditioning on null sets is ill-defined (Borel-Kolmogorov paradox; or in the scenario of my comment in my previous question, there is no way of randomly generating an arbitrary rational number in $[0,1]$ in a "uniform" fashion --- cf. StackOverflow --- much like there is no way of generating an arbitrary integer in a "uniform" fashion), the reason why conditioning on the null events $X=x$ is fine is because if my conjecture is true, then it just boils down to plugging in an explicit value for $X$ and evaluating the probabilities/expectations as normal. In more detail, if we have $Y = f(Z,X)$, then fixing $x_0$ in the codomain of $X$ we have $\mathbb E(Y|X=x_0) = \mathbb E(f(Z,x_0))$ (which then can specialize to statements about conditional probabilities).
 A: The answer is "yes" if we are allowed to extend the probability space by including a random variable $U$ that is uniformly distributed over $[0,1]$ and independent of $X$ and $Y$.  The heart of this fact is given in Proposition 5.13 of Kallenberg's "Foundations of Modern Probability."  I will simplify Kallenberg's statement.  Kallenberg assumes we have already extended the space to include $U$, I will write the statement with $U$ explicitly:
Simplified Kallenberg Prop. 5.13: If $X:\Omega\rightarrow\mathbb{R}$ and $Y:\Omega\rightarrow\mathbb{R}$ are random variables and $U:\Omega\rightarrow [0,1]$ is a random variable that is uniformly distributed over $[0,1]$ and is independent of $(X,Y)$, then there is a Borel measurable function $f:\mathbb{R}^2\rightarrow\mathbb{R}$ and a random variable $Z:\Omega\rightarrow\mathbb{R}$ that is independent of $X$ such that $Y=f(X,Z)$ almost surely.
[Some additional generalizations that Kallenberg shows that I am not giving in the above simplified statement: Kallenberg shows $Z$ can be assumed to be uniformly distributed over $[0,1]$; Kallenberg also allows $X$ to be a general random element (not real valued) and has some additional conditional independence generalizations. Kallenberg allows $Y$ to take values in a Borel space, including $\mathbb{R}^k$ for some positive integer $k$, instead of just $\mathbb{R}$, but he crucially needs the Borel structure for $Y$ whereas that Borel structure is not needed for $X$.]
[A minor extension of Kallenberg: While Kallenberg does not say this, a minor extension that I can show  (with a relatively easy proof) is that the $Y=f(X,Z)$ statement can be assumed to hold surely, not just almost surely. I can give a simple proof of that if desired.]

Example: For the case of Aaron's example, the original space $(\Omega, \mathcal{F}, P)$ is
$$ \Omega = \{a,b,c\} \mbox{ (equally likely)} $$
where $\mathcal{F}$ is the power set of $\{a,b,c\}$. The new space is
\begin{align}
\Omega' &= \Omega \times [0,1] = \{(i,u) : i \in \{a,b,c\}, u \in [0,1]\}\\
F' &= \mathcal{F} \otimes \mathcal{B}([0,1])
\end{align}
where $\mathcal{B}([0,1])$ is the Borel sigma algebra on $[0,1]$. Define $A$ and $U$ as the first and second coordinates for all $(i,u) \in \Omega'$, and define $X$ and $Y$ as in Aaron's example
\begin{align}
&A(i,u) = i\\
&U(i,u) = u\\
&X(i,u) = 1_{\{i=a\}} + 1_{\{i=b\}}\\
&Y(i,u)= 1_{\{i=b\}} + 1_{\{i=c\}} 
\end{align}
Then $P'$ is the unique measure that satisfies $P[A=i, U\in B]=P[A=i]P[U \in B]$ for all $i \in \{a,b,c\}$, $B \in \mathcal{B}(\mathbb{R})$.  Now define
$$ Z(i,u) = \left\{\begin{array}{cc}
0 & \mbox{ if $i=a$} \\
1 & \mbox{ if $i=b$} \\
1_{\{u\leq 1/2\}} & \mbox{ if $i=c$}
\end{array}\right.$$
and define $f(i,j)$ by
\begin{align*}
f(1,0)&=0\\
f(1,1)&=1\\
f(0,0)&=1\\
f(0,1)&=1
\end{align*}
Now we can say that
$$ \boxed{Y=f(X,Z)}$$
where $X, Z$ are independent. The fact that $Y=f(X,Z)$  is because for all $u \in [0,1]$:
\begin{align}
Y(a,u) &=  0 = f(1,0) = f(X(a,u), Z(a,u)) \\
Y(b,u) &= 1 = f(1,1) = f(X(b,u), Z(b,u)) \\
Y(c,u) &= 1 = f(0,1_{\{u\leq 1/2\}}) = f(X(c,u), Z(c,u)) 
\end{align}
The fact that $X$ is independent of $Z$ is because $P[Z=0]=P[Z=1]=1/2$ and
\begin{align}
P'[X=0,Z=0] &=P'[A=c, U> 1/2] = (1/3)(1/2) = P'[X=0]P'[Z=0]\\
P'[X=0,Z=1] &=P'[A=c, U\leq1/2] = (1/3)(1/2) = P'[X=0]P'[Z=1]\\
P'[X=1, Z=0] &= P'[A=a] = (1/3) = P'[X=1]P'[Z=0]\\
P'[X=1, Z=1] &= P'[A=b] = (1/3) = P'[X=1]P'[Z=1]
\end{align}

My own minor extension of Kallenberg Prop. 5.13 to "surely":
Claim: If $X:\Omega\rightarrow \mathbb{R}$ and $Y:\Omega\rightarrow\mathbb{R}$ are random variables and $U:\Omega\rightarrow [0,1]$ is uniformly distributed over $[0,1]$ and is independent of $(X,Y)$, then
a) There is a Borel measurable function $f:\mathbb{R}^2\rightarrow \mathbb{R}$ and a random variable $Z:\Omega\rightarrow\mathbb{R}$ that is independent of $X$ such that $Y=f(X,Z)$ surely.
b) We can ensure the $Z$ from part (a) is in fact $Z:\Omega\rightarrow [0,1]$ and uniformly distributed over $[0,1]$.
Proof a):  Kallenberg's Prop. 5.13 shows we get a Borel measurable function $f:\mathbb{R}^2\rightarrow\mathbb{R}$ and a random variable $Z:\Omega\rightarrow [0,1]$ that is uniformly distributed over $[0,1]$ and independent of $X$ such that $Y=f(X,Z)$ almost surely.  Define
$$ A = \{\omega \in \Omega: Y(\omega) \neq f(X(\omega), Z(\omega))\}$$
Then $A$ is a valid event and  $P[A]=0$. Define
$$\tilde{Z} = Z1_{A^c} + g(Y)1_{A}$$
where $g:\mathbb{R}\rightarrow [3,4]$ is a measurable bijection with a measurable inverse. Now we see that $Z=\tilde{Z}$ almost surely, so $X$ and $\tilde{Z}$ are independent.  Now we observe that since $g$ maps points to values larger than 1 we get
$$\tilde{Z} \in [0,1] \implies \{\tilde{Z}=Z\}\cap A^c \implies f(X,\tilde{Z})=Y$$
$$\tilde{Z}>1 \implies \tilde{Z}=g(Y) $$
Define the measurable function $\tilde{f}:\mathbb{R}^2\rightarrow\mathbb{R}$ by
$$\tilde{f}(x,z) = \left\{\begin{array}{cc}
f(x,z) & \mbox{ if $z \in [0,1]$} \\
g^{-1}(z) & \mbox{ if $z>1$} 
\end{array}\right.$$
Then $Y=\tilde{f}(X,\tilde{Z})$ surely.
$\Box$
Proof b):  The $\tilde{Z}$ in part (a) is already uniformly distributed over $[0,1]$, but it can still take values larger than 1. To fix this define $C$ as a measure 0 Cantor subset of $[0,1]$ and define $h:\mathbb{R}\rightarrow C$ as a measurable bijection with measurable inverse. Define $Z':\Omega\rightarrow [0,1]$ by
$$ Z' = \tilde{Z} 1_{\{\tilde{Z} \in [0,1]\} \cap \{\tilde{Z} \notin C\}} + h(Y)1_{\{\tilde{Z}>1\} \cup \{\tilde{Z}\in C\}}$$
So $Z' \in [0,1]$ surely.
Now $P[\tilde{Z}\in [0,1]]=P[\tilde{Z} \notin C ]=1$. So $Z'=\tilde{Z}=Z$ almost surely, so again $Z'$ is uniformly distributed over $[0,1]$ and independent of $X$. Then define
$$h(x,z) = \left\{\begin{array}{cc}
\tilde{f}(x,z) & \mbox{ if $z \notin C$} \\
h^{-1}(z) & \mbox{ if $z \in C$} 
\end{array}\right.$$
Then $Y=h(X,Z')$ surely.
$\Box$
A: To expand on Kavi Rama Murthy's helpful comment:
Consider the example of $\Omega = \{a, b, c\}$ for which $\mathbb P(a) = \mathbb P(b) = \mathbb P(c) = 1/3$. Note that $\Omega$ does not admit any nontrivial independent events at all; if $A, B$ are neither $\emptyset$ nor $\Omega$, then  $\mathbb P(A) \mathbb \cdot P(B)$ has a denominator of $9$ in reduced form and cannot possibly be equal to $\mathbb P(A \cap B)$.
To complete the counterexample, let $X$ be defined so that $X(a) = X(b) = 1$ and $X(c) = 0$; define $Y$ so that it is not a scalar multiple of $X$, i.e. $Y(a) = 0$ and $Y(b) = Y(c) = 1$.
