Why can we change a limit's function/expression and claim that the limits are identical? Say you have limit as $x$ approaches $0$ of $x$. You could just write it as $\frac{1}{\frac{1}{x}}$ and then the expression would be undefined. So what are you really doing when you "rearrange" an expression or function so its limit "works", and doesn't have any division by zero? Why can we suddenly change one expression to another, when they are not exactly the same, and say the limit is the same? For example, the expression $x$ is not equal to the expression $\frac{1}{\frac{1}{x}}$ because the latter is not valid for $x=0.$

Remark: sort of a long comment.
What you are rediscovering are so called removable singularities: Note that the functions 
$$f(x)=x$$
and 
$$\tilde{f}(x)=\frac{1}{\frac{1}{x}},$$
are not the same, as they domain of definition differs:
the first is defined for all real numbers, whereas the second is not defined at zero (as you noticed).
But one can adjust the second by defining
$$\bar{f}(x):=\begin{cases}\tilde{f}(x)&, x\neq 0\\0 &, x=0\end{cases}.$$
As explained in the other answers, $\lim_{x\rightarrow 0}\bar{f}(x)=0,$ which implies that the function is continuous at $0$ (as was clerly expected).
Such an adjustment is called removal of singularity.
