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$