In general, a particle mass is determined by observing resonance peaks in scattering. Breit-Wigner sounds familiar? The width of the peak gives the lifetime.
Quarks are another matter, as you've noted. In the quark model of hadrons, it is assumed that binding energies follow simple forms, and quarks make up the rest of the mass. A simple data fit is then used. A lot of hadrons fit into this pattern, but several do not.
In QCD, the bare quark masses are very small. Very, very, small. All of the mass of hadrons are considered to due to localisation energy or imperfect cancellation of colour charge.
In deep scattering experiments, the masses are determined running the renormalisation group for a bit and will interpolate between the bare mass and the fitted mass of the quark model for hadrons.