If you want an answer in form of a mathematical function definition, using only functions that were in common use in undergraduate instruction fifty years ago, I do not think you can do much better than the excellent answer by Rhys Hughes.
As noted in the answer, this is how mathematicians often define a function equivalent to yours in textbooks.
The only detail you might want to add is something to deal with the case $x = y = 0.$
Note that the formulas in that answer do not tell you how to find $\theta,$
but they do uniquely identify the output of the function for any possible input.
There is always some value of $\theta$ that will satisfy both equations when
$x^2 + y^2 \neq 0,$ and there will never be more than one value of $\theta$ that satisfies both equations.
If you want a formula to compute the angle using only functions that were in common use in undergraduate instruction fifty years ago, I think the formula you wrote is close to the best you can get, though I would handle one or two cases a bit differently.
If you want a nice way to represent your function in other formulas, you can borrow the two-parameter arc tangent function that is defined in many software packages.
That is, define a function $\operatorname{atan2}(y, x)$
whose value is the angle of the vector $\begin{bmatrix} x \\ y \end{bmatrix}.$
You can define $\operatorname{atan2}(y, x)$ either in the style of the complex analysis textbooks described in the other answer, or you can define it in your style:
$$
\operatorname{atan2}(y, x) = \begin{cases}
\arctan\left(\frac yx\right) & x \gt 0 \\
\arctan\left(\frac yx\right) + \pi \quad & x \lt 0, \ y \geq 0 \\
\arctan\left(\frac yx\right) - \pi \quad & x \lt 0, \ y < 0 \\
\frac\pi2 & x = 0,\ y > 0 \\
-\frac\pi2 & x = 0,\ y < 0 \\
\text{undefined} & x = 0,\ y = 0.
\end{cases}
$$
When this is implemented in software I think the "undefined" case usually returns $0.$
If you have to write formulas involving the direction angles of several two-dimensional vectors in terms of their components, then you might find the notation
$\operatorname{atan2}(y, x)$ convenient.
atan2
being used in the "Converting between polar and Cartesian coordinates" section of Wikipedia's "polar coordinate system" entry. Who are these people you've been talking-to who "usually" just usearctan
? – Blue Jan 20 '19 at 15:06ArcTan
function: when fed just one argument, it gives the regular inverse-tangent; when given both $x$ and $y$ arguments, it gives the quadrant-savvy version of the angle (equivalent toatan2
). – Blue Jan 20 '19 at 15:20