By a composition being Lebesgue measurable I assume you mean $f \circ g$ is $(\mathcal{L}, \mathcal{B})$-measurable where $\mathcal{L}$ is the Lebesgue sigma algebra and $\mathcal{B}$ is the Borel sigma algebra. We want to know whether $f$ is $(\mathcal{L}, \mathcal{B})$-measurable.
Let $g(y) = y^2$ and $f(x): \mathbb{R} \to \mathbb{R}$. Then for any $B \in \mathcal{B}$ we necessarily have $f^{-1}(g^{-1}(B)) \in \mathcal{L}$ by assumption. To show $f$ is $(\mathcal{L}, \mathcal{B})$-measurable we need that $f^{-1}(A) \in \mathcal{L}$ for any $A \in \mathcal{B}$. But, if we let $B = g(A)$ for some $A \in \mathcal{B}$ then we have only that $A \subset g^{-1}(B)$ and know only that $f^{-1}(g^{-1}(B)) \in \mathcal{L}$; there is no guarentee that $f^{-1}(A) \in \mathcal{L}$. In other words, there exist Borel sets $A$ for which we cannot be sure $f^{-1}(A) \in \mathcal{L}$, so $f$ is not necessarily $(\mathcal{L}, \mathcal{B})$-measurable.
If $g$ were injective on $\mathbb{R}$ like $g(y) = y^3$ then we would have $A = g^{-1}(g(A))$ and then $f$ would be $(\mathcal{L}, \mathcal{B})$-measurable.