The pdf is $$ f(y;\lambda_1,\lambda_2,w) = w\lambda_1e^{-y\lambda_1}+(1-w)\lambda_2e^{-y\lambda_2}$$ where $\lambda_1,\lambda_2$ are given as rates of exponential distribution for r.v's $X$ and $Y$, $w$ is some unknown parameter, and $y$ is the observation of $X$ and $Y$.
I am struggling to understand this question. The marginal distribution is
$$ \int_0^{f(y)} 1 ~dw = \int \mathbb{1}_{0<w<f(y)} dw, $$ and so $f(y)$ can be interpreted as the marginal density of a uniform distribution on the area under the density $f(y)$. Is this correct?
Yes, you are right.
However, independently of the specific form of your pdf, let $f(y)$ be any pdf and define $g(y,z)$, a two dimensional pdf the following way.
$$g(y,z)=\begin{cases} 1&\text{ if }& 0\leq z\leq f(y)\\ 0&\text{ otherwise.} \end{cases}$$like it is shown below.
The marginal distribution of $Y$ is given by the following integral:
$$f_Y(y)=\int_{-\infty}^{\infty}g(y,z)\ dz=\int_0^{f(y)}\ dz=f(y).$$
Note that this is just one possibility of defining $g$.