Let $\mu$ be a probability measure on $\mathcal{X}$ and suppose that $S$ is a dense subset in $L^2(\mu)$.
This means that if $f \in L^2(\mu)$ is a function $\mathcal{X} \to \mathbb{R}$ of the random variable $X \sim \mu$, then there exists a sequence $f_n \in S$ such that $$ \mathbb{E}_\mu\Big[(f_n(X) - f(X))^2\Big] \equiv \|f_n - f\|^2_{L^2(\mu)} \to 0, \quad \mbox{as}~n \to \infty. $$
Let us consider a real-valued measurable function $g$, and $$ \mathcal{F}(g) := \Big\{ f : \int f(x, g(x))^2 \, d\mu(x)< \infty\Big\}. $$ This is the space $L^2(\mu_g)$ where $\mu_g$ is the joint probability measure on $\mathcal{X} \times \mathbb{R}$, where for cylindrical sets we have $$ \mu_g(A \times B) = \int_A 1_{B}(g(x)) \, d \mu(x). $$
where $1_B(g) = 1$ if $g \in B$ and is $0$ otherwise.
Since $S$ is dense in $L^2(\mu)$ can we construct a dense subset of $L^2(\mu_g)$ based on this?