How does it make physical sense to define mass in terms of magnitude of the 4-momentum? One can show that for a point particle of mass $m$, in Special Relativity its energy in terms of the velocity is given by $$E=\frac{mc^2}{\sqrt{1-\frac{v^2}{c^2}}}. \tag 1$$
A remarkable feature of this expression is that it is indeterminate if we set $v:=c$. If, in analogy with the non-relativistic expression $T=\frac{p^2}{2m},$ one wants to find the energy in terms of momentum, we use the expression $p=\frac{mv}{\sqrt{1-\frac{v^2}{c^2}}}$, solve for $v$ on it and substitute in (1), obtaining after some algebra
$$E=\sqrt{m^2c^4+p^2c^2}, \tag 2$$
which is a very useful expression. Now here comes my issue. If we substitute $m:=0$, then it is not allowed to obtain from this $E=pc$ because we derived this expression assuming $m \neq 0$. The way I have seen that most books get out of this conundrum is to simply define mass by equation (2) which can be written in terms of the momentum four-vector as $m=\frac{\sqrt{p^{\mu}p_{\mu}}}{c}$. However this seems to me like a contrived and ad hoc thing to do. Why not, for example, define velocity as $v=\frac{pc^2}{E}$?
 A: I think your mistake is in taking $(1)$ as the fundamental equation and $(2)$ as the derived expression. Instead, you should define four-momentum of a particle as the mass times the four-velocity. Four velocity can be defined using differentation wrt proper time.
After that, mass equals the length of the four momentum vector. Note that it equals the length of the four-momentum vector. I wouldn't say that it's defined to be that length.
As for the definition, you can define mass as the measure of inertia. For example, if there's an electromagnetic field $F^{\mu \nu}$ at a spacetime point, and a particle is located at that point, then the mass of the particle is the constant $m$ such that this equation holds true:
$$m\frac{dv^{\mu}}{d\tau}=qF^{\mu}_{\nu} v^{\nu}$$
which is just the special relativity version of Newton's second law. Maybe gravitational force can be used to define masses of electrically neutral bodies. The main point is mass is whatever constant happens to predict the correct trajectory of the body when fed into the Lagrangian/Hamiltonian.
Okay, but this still does not define the mass of light, because light is not some particle which experiences the electromagnetic force. Light is a field. If you look at the generic equations of Lorentz invariant free fields, they look like:
$$\partial _{\mu}\partial ^{\mu} A^{\mu} - m^2A^{\mu}=0$$
The $m$ here is defined to be the mass of the field. It's whatever constant happens to describe the field correctly. To describe waves moving at speed $c$ (=1 in the above equation), you need $m=0$.
Turns out, you can ascribe energy and momentum densities to each point of the field. If you integrate these densities, you get an energy-momentum four vector of the field. Being a four-vector, it has a length which equals the constant $m$ in the wave equation.
A: 
Why not, for example, define velocity as $v=\frac{pc^2}{E}$?

Because we already know what velocity (speed) is - rate of change of particle coordinates. Coordinates as function of time are much easier to measure than energy or momentum.
Thus there is no point in introducing new definition of velocity based on $E,p$.
The relation $E = pc$ for Poynting energy of light waves can be (and historically was) derived from EM theory. No definition of mass of light wave is needed for that.
A: It's actually pretty simple: we define it that way because it fits with experiment. The relationship between momentum and energy for light is $E = pc$. That is, in fact, our old friend from intro to physics $v=f\lambda$, just use the facts that $E = h f$ and $p = h / \lambda$. You could also derive that expression from Maxwell's equations and the stress-energy tensor.
It is also a fact, both observed and derived, that $(mc^2)^2 = E^2 - (pc)^2$ works for massive particles. Because that equation works for both massive and massless particles, it is a more useful and general starting point than $E = \gamma m c^2$.
That said, it's actually pretty tricky to operationally define mass - there are good reasons why "le grand K" was the last physical artifact to define a unit in the SI system. So, while saying that the equation $(mc^2)^2 = E^2 - (pc)^2$ defines mass is fine from a theoretical algebraic standpoint, the actual practical definition is done in terms of a the force generated by a gravitational field compared with a standard force of defined magnitude. The standard force is provided by something called a Kibble balance. You then measure some accelerations and velocities very precisely, and you get a measurement of mass in terms of power used to do the measurement.
A: Velocity is a kinematic variable, defined as the derivative of position in time (taking care of what we mean for position, time and thus velocity when we treat Relativistic Mechanics), and can be measured without any need of dynamic variables related with mass, momentum and forces.
So, a definition of the velocity using dynamic variables would be very odd.
From the definition of 4-velocity, you can introduce the definition of 4-momentum.
On the other hand, you already have different more general definitions of energy valid for both massive and massless particles, as highlighted by Sean E. Lake in his answer.
Assuming that:

*

*both the definitions you use for velocity, as the derivative of position in spacetime, and the definitions of energy holds;

*the limiting condition for small velocity leads to classical mechanics;

you get the interpretation of mass, of rest mass, and the relation between mass, momentum and energy in relativistic mechanics.
A: \begin{align*}
&\text{4 vector}\\
&\mathbf{u}^\mu=\begin{bmatrix}
                   \gamma\,c \\
                   \gamma\,v \\
                 \end{bmatrix}\quad   \gamma=\frac{1}{\sqrt{1-(v/c)^2}} \\
&\text{momentum}\\                 
&\mathbf p^\mu=m\,\mathbf u^\mu=\begin{bmatrix}
                   m\,\gamma\,c \\
                   m\,\gamma\,v \\
                 \end{bmatrix}\\\\
&\text{but also }\\                 
&\mathbf{p}^\mu=\begin{bmatrix}
                  m\,c \\
                  m\,\mathbf{v} \\
                \end{bmatrix}
 =\begin{bmatrix}
                    \frac{E}{c} \\
                    \mathbf{p}^i\\
                  \end{bmatrix}
\end{align*}
thus
\begin{align*}
 &\begin{bmatrix}
                   m\,\gamma\,c \\
                   m\,\gamma\,v \\
                 \end{bmatrix}
\overset{!}{=}\,\begin{bmatrix}
                    \frac{E}{c} \\
                    \mathbf{p}^i\\
                  \end{bmatrix}                
                 \quad\Rightarrow\\\\
&E=m\,c^2\,\gamma=m\,c^2\,\frac{1}{\sqrt{1-(v/c)^2}} 
\end{align*}
