a zillion gluons and quarks and anti-quarks self annihilating and popping into existence
and while this is a very common way to describe the interior of a hadron like a proton it is actually rather misleading. Nothing is popping into existence then disappearing again. But explaining what is actually happening is a little involved.
Our current best theory for describing particle is quantum field theory. In this theory the fundamental objects are quantum fields that exist everywhere in the universe. Particles like quarks are not fundamental objects. Instead they are just states of the quantum field. This nicely explains how particles can be created and annihilated at colliders like the LHC, because we can start with a zero particle state of the quantum field and add energy to it to excite it to states that correspond to non-zero numbers of particles. Likewise a state of the field that corresponds to particles can decay to a state with fewer or no particles.
But while there are states of the field that do correspond to what we call particles, this is actually a rather special case. Specifically this is only the case when we have an isolated particle that isn't interacting with any other particles. These are called the Fock states of the field. But the field has an infinite number of other states that aren't Fock states so they don't correspond to particles. The problem is that we don't know how to solve the equations of the field to get these states. Instead we have to use approximate methods to calculate properties like their mass.
And this is the case for the bound states we call hadrons. A proton is a state of the quantum field but it isn't a Fock state. In principle we could write down the equation for the field and solve it to get the state corresponding to a proton, but in practice we simply don't know how to do this so we have to approximate it. We do this by approximating the state as a collection of virtual particles, and this is why popular science descriptions talk about particles popping into existence and disappearing again. Where the popular science articles go wrong is that these virtual particles are a computational device and they do not exist. I cannot emphasise this enough: the virtual particles are just a way of calculating the properties of field states that are not Fock states and therefore do not correspond to particles.
This has taken us a long way from your question, but we can now understand why the mass of a proton is well defined. It is because it is a well defined state of quantum fields and as such has a well defined mass. It just doesn't correspond to a well defined number of particles, which is why it isn't just three quarks or $n$ quarks and $m$ gluons or any other collection of particles.
If you're interested in finding out more about this you might want to look at my answer to Are vacuum fluctuations really happening all the time? where I use a similar argument to explain why the vacuum isn't actually fluctuating either.