Is this true in general?:
Let $f(x)$ and $g(x,y)$ be two functions. Let $h$ be a function given by:
$$h(y)=\int_{-\infty}^\infty f(x)g(x,y)\,dx$$
then
$$f(x)=\int_{-\infty}^\infty \frac{h(y)}{g(x,y)}\,dy$$
Is the above always true (and it's just that in case of Fourier transform, it happens to have a geometrical meaning in terms of sinusoids)?
It is not even true in the case of the Fourier transform, as the factor $\frac{1}{2\pi}\exp(\mathrm i x y)$ for the reverse transform differs from the inverse of the factor $\exp(-\mathrm i x y)$ for the transform by a factor of $\frac{1}{2\pi}$.
Indeed, if you insert the second of your equations into the first, you have to be careful with the naming, as the integration variable $x$ from the first equation is not the same as the function argument from the second. So you get from those two equations: $$f(x') = \int_{-\infty}^{\infty} \frac{1}{g(x',y)} \int_{-\infty}^{\infty} f(x) g(x,y)\,\mathrm dx\,\mathrm dy = \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} f(x)\frac{g(x,y)}{g(x',y)}\,\mathrm dx\,\mathrm dy$$ As you can see, the $g$ terms in the fraction have different variables, and therefore do not cancel out, unless $g$ happens to be independent of its first argument. However, as noted by AlexanderJ93 in the comments, even if the factor cancels out, you don't get the original function back unless $f(x)=0$, as in that case you get $f(x^\prime) = \int_{-\infty}^\infty C\,\mathrm dy$ where $C = \int_{-\infty}^\infty f(x)\,\mathrm dx \in \mathbb{R}$. Of course if $f(x)=0$, any $g$ without zeros will give back $f$.