You are misunderstanding what they mean by not mathematically valid in this situation. It has little to do with whether or not there is a proof and more to do with some formalism.
When we write $\frac{dy}{dx}$ I'm sure you've heard already that this is not a fraction. In particular this is really saying to apply the differential operator $\frac{d}{dx}$ to the function $y$.
So when you perform separation of variables by transitioning from $\frac{dy}{dx}=g(x)h(y)$ to $\frac{dy}{h(y)}=g(x)dx$ we have done something that seems to be fundamentally incorrect we took the operator $\frac{d}{dx}$ and split it as if it was a fraction. This obviously makes no sense if we really think of $\frac{d}{dx}$ as an operator and moreover the $dx$ and $dy$ we end up with make no sense either as we don't even know what they should mean.
On the other hand the resulting integrals $\int\frac{1}{h(y)}dy=\int g(x)dx$ actually have a reasonable mathematical meaning and moreover assuming $g(x)$ and $h(y)$ aren't very awful you get the correct result.
Now the fact that the resulting integral equation gives you the correct result is absolutely provable, we just shouldn't have gotten to it the way we did. Instead the following approach is appropriate:
$$\frac{dy}{dx}=g(x)h(y)$$
then assuming $h(y)$ is not $0$.
$$\frac{1}{h(y)}\frac{dy}{dx}=g(x)$$
Further assuming both sides are integrable we get
$$\int\frac{1}{h(y)}\frac{dy}{dx}dx=\int g(x)dx$$
Now performing a substitution in the integral on the left we get
$$\int\frac{1}{h(y)}dy=\int g(x)dx$$
Now even in this explanation I've cheated in a few places slightly but it's a reasonable first approximation to explaining why separation of variables is a correct method for solving differential equations.
Edit You can actually build mathematics in such a way that $dy$ and $dx$ do have a reasonable meaning on their own and that you can pretty much treat $\frac{dy}{dx}$ as a fraction. This is usually called non-standard mathematics and makes use of something called infinitesimals. It's not particularly easy to do though and you still end up having some issues.