Since we are not feeling clever, we use a general procedure. We work directly with expectations. Let $e$ be the expected length of the walk.
Let $a$ be the expected length of a walk, if we start at $2$ and stop when we first end up at $1$. By symmetry, this is the same as the expected length of a walk if we start at $4$ and stop when we end up at $1$.
Let $b$ be the expected length of a walk starting from $3$, and stopping when we return to $1$.
Note that $b=1+\frac{1}{2}a+\frac{1}{2}a=a+1$. This is because if we are at $3$, it takes us a step to go to $2$ or $4$, and in each case our expectation when we get there is $a$.
Note also that $e=1+\frac{1}{2}a+\frac{1}{2}a=a+1$. This is because we take a step, and end up at a place that has expectation $a$. Finally, $a=1+\frac{1}{2}b=1+\frac{1}{2}(a+1)=\frac{3}{2}+\frac{1}{2}a.\tag{$1$}$ This is because if we are at say $2$, we take a step, and with probability $\frac{1}{2}$ it's over. With probability $\frac{1}{2}$ we end up at $3$, from where the expectation is $a+1$.
From $(1)$, we conclude that $a=3$ and therefore $e=4$.