Seems that I just proved $2=4$.
Let's add the hypothesis that $x>0$ to the problem, so that it's clear your derivations are correct.
Pay attention to what you've proven:
- If $x^{x^{\cdot^\cdot}} = 2$, then $x = \sqrt{2}$
- If $x^{x^{\cdot^\cdot}} = 4$, then $x = \sqrt{2}$
This is very different from
- If $x = \sqrt{2}$, then $x^{x^{\cdot^\cdot}} = 2$
- If $x = \sqrt{2}$, then $x^{x^{\cdot^\cdot}} = 4$
Your argument that $2=4$ requires this latter pair of statements, but you haven't proven either of them; instead, what you've proven are the first pair of statements!
It's easy to get in the habit of forgetting about the direction you've argued a problem, and in many situations, arguments are reversible, making it hard to see why direction matters. But this is an example of the dangers of getting things wrong!
Incidentally, if $x = \sqrt{2}$ then $x^{x^{\cdot^\cdot}} = 2$ is correct, if we assume the usual meaning of infinite power towers as a limit of finite ones. If you're familiar with limits of sequences, then you can use an inductive proof to show that the sequence
$$ a_0 = \sqrt{2} \qquad \qquad a_{n+1} = \sqrt{2}^{a_n} $$
is strictly increasing and bounded above by $2$, and so the limit converges. And if $L$ is the limit, then because exponentiation is continuous, we can take the limit of the recursive relation to see that
$$L = \sqrt{2}^L$$
letting you complete the proof.
You have merely shown that the equation $\sqrt 2^y = y$ has more than one solution.
Then you assumed that $x^{x^{x^\ldots}}$ somehow made sense and tried to talk about it as if it meant "the solution $y$ of $x^y = y$". Which of course is nonsense when the equation has several solutions.
Your reasoning does not make sense because you did not specified what does $x^{x^{x\ldots}}$ mean. It is not a finitary operation so it is not clear what does that term denote. If it stands for an outcome of a certain limiting procedure then you are in trouble since that limit can be $1$ or $\infty$ for positive $x$. Thus with this interpretation your premises are false and you can deduce from them anything you want, for instance that $0=1$.
In general, you can solve the equation in terms of the Lambert W function as
$$ y=x^{x^{x^{.^{.^.}}}} \implies \ln(y)=y\ln(x) \implies y = -\frac{W(-\ln(x))}{\ln(x)}. $$
Try to use this closed form to see what the problem is. Note this, if you ask maple to solve the equations
$$ -\frac{W(-\ln(x))}{\ln(x)}=2,\quad -\frac{W(-\ln(x))}{\ln(x)}=4, $$
you will get the same answers
$$ x=1,\sqrt{2} $$
More generally, the solution of
$$ -\frac{W(-\ln(x))}{\ln(x)}=a $$
is given by
$$ \left\{ x=1,x={{\rm e}^{{\frac {\ln \left( a \right) }{a}}}}\right\}. $$
Now, if you use the above solution with $a=2,4$, you will see why?