Why define $|x|$ by a piecewise function?
I'm not sure if there is a good answer to this question. Both definitions have their merits. Your definition is just a special case of the definition of the standard metric on $\mathbf{R}^n$. Namely, $$ d_E(x,y)=\sqrt{\sum_{i=1}^n(x^i-y^i)^2}$$ where $x=(x^1,\ldots, x^n)$ and $y=(y^1,\ldots y^n)$. In this case, $\lvert x\rvert $ is simply the Euclidean distance of $x$ from the origin in $\mathbf{R}$. That is, $$ \lvert x\rvert=\sqrt{x^2}.$$ On the other hand, sometimes it is nice to regard $\lvert x\rvert$ as two lines. That is, $$ \lvert x\rvert=\begin{cases} x&x\ge 0\\ -x&x<0. \end{cases}$$ In the latter case, we just know that we can pretend $\lvert x\rvert$ is either $x$ or $-x$ depending on which side of the origin we are on. In short, both of these definitions are fundamental and equally valid.
The definition for $|x|$ is naturally stated in terms of diferent conditions, depending whether $x \geq 0$ or $x<0$ because $|x|$ is distance from $0$ to $x$ and we agree that distance is always $\geq 0$.
The definition $|x|=\sqrt {x^2}$ is also fine because when we talk about square root we agree that square root of nonnegative real number is nonnegative itself so $\sqrt {x^2}$ is never a negative number and it equals $|x|$ because of $(-x)^2=x^2$.
The way in which you arrived at "your" definition is kind of not practical because you use complex numbers to define distance on the real line and they are certainly not needed to do that.