In a sense, you are repeating the old criticism of Bishop Berkeley on infinitesimals, which were "sometimes not equal to $0$, and sometimes equal to $0$".
What you need to remember is that the expression
$$\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$
represents the unique quantity (if it exists) that the expression $\dfrac{f(x+h)-f(x)}{h}$ approaches as $h$ approaches $0$, but without $h$ being equal to $0$. Whenever we take a limit, we are asking how the quantity is behaving as we approach $0$, but without actually being $0$.
Because we are never actually at $0$, the simplification is valid, and so the computation turns on asking: what happens to the quantity $2x+h$ as $h$ approaches $0$?
The answer is that, the closer $h$ gets to $0$, the closer that $2x+h$ gets to $2x$. We can make $2x+h$ as close to $2x$ as we want, provided that $h$ is close enough to $0$, without being equal to $0$.
We are not actually evaluating at $0$ (well, we kind of are, see below, but not really); we are just finding out what happens to $2x+h$ as $h$ gets closer and closer and closer to $0$. So we are not "simplifying" the way we did before, we are now evaluating the limit, by determining what happens to $2x+h$ as $h$ approaches $0$.
(Now, in a sense we are evaluating, for the following reason: the function $g(h) = 2x+h$, where $x$ is fixed, is continuous and defined everywhere. One of the properties of continuous functions (in fact, the defining property of being continuous) is that $g(t)$ is continuous at $t=a$ if and only if $g$ is defined at $a$, and
$$\lim_{t\to a}g(t) = g(a).$$
That is, if and only if the value that the function approaches as the variable approaches $a$ is precisely the value of the function at $a$: there are no jumps, no breaks, and no holes in the graph at $t=a$. But we are not "simplifying" by "plugging in $a$", we are actually computing the limit, and finding that the limit "happens" to equal $g(a)$.
This cannot be done with the original function $\dfrac{f(x+h)-f(x)}{h}$ because, as you note, it is not defined at $h=0$. But there is a result about limits which is very important:
If $f(t)$ and $g(t)$ have the exact same value at every $t$, except perhaps at $t=a$, then $$\lim_{t\to a}f(t) = \lim_{t\to a}g(t).$$
the reason being that the limit does not actually care about the value at $a$, it only cares about the values near $a$.
This is what we are using to do the first simplification: the functions of variable $h$ given by:
$$\frac{(x+h)^2-x^2}{h}\qquad\text{and}\qquad 2x+h$$
are equal everywhere except at $h=0$. They are not equal at $h=0$ because the first one is not defined at $h=0$, but the second one is. So we know that
$$\lim_{h\to 0}\frac{(x+h)^2 - x^2}{h} = \lim_{h\to 0}(2x+h).$$
And now we can focus on that second limit. This is a new limit of a new function; we know the answer will be the same as the limit we care about, but we are dealing with a new function now. This function, $g(h) = 2x+h$, is continuous at $h=0$, so we know that the limit will equal $g(0)=2x$. Since this new limit is equal to $2x$, and the old limit is equal to the new limit, the old limit is also equal to $2x$. We didn't both take $h\neq 0$ and $h=0$ anywhere. We always assumed $h\neq 0,$ and then in the final step used continuity to deduce that the value of the limit happens to be the same as the value of the function $g(h) = 2x+h$ at $h=0$. )