A few weeks ago I found a video on my YouTube feed that had the problem $f'(e^{x^2})=e^{x^2}$ on its thumbnail. I was disappointed to find that the video was intended to fix problems students might have with the chain rule, but I tried to solve that problem anyway. It was easy to solve ($f'(x)$ should equal $x$ for this to be true) but what about $f'(g(x))=h(x)$? How can I solve this equation, where $g$ and $h$ are given? If $g$ is invertible then clearly $f(x)=\int h(g^{-1}(x))dx$, but what if it isn't?
General cases for $g$ and $h$ are accepted.