I'm compensated fairly, and my pension makes it actually quite well compensated. The career does suck and I wouldn't recommend it to anyone, but for someone needing mobility from generational poverty it can work.
The career opportunities upon retirement are nothing to be trivialized either. Compensation there may not be SWE level, but it's WELL above median.
Military isn't paid too badly once you factor in pensions and benefits. The amount of salary that you'd have to save to construct something similar out of 401ks is... high.
I don’t think many people understand just HOW high.
Aside from monetary compensation (which can range widely, and typically is made up of 25-50% tax sheltered disability pay) there is health insurance at a maximum out of pocket of $3600/year for a family ($600 premium plus $3000 catastrophic cap), tax free shopping, discounted fuel, free flights, remarkably cheap lodging all over the US and in allied countries, and the list goes on.
The last calculation I saw for an average Senior Enlisted retiree was that you would need a lump sum of in excess of $3 million to hope to compare, invested at a decent return. Albeit that’s not completely accurate, but it’s as close as we can get given such different financial vehicles.
It's more like the requirement to do the job without being able to quit for at least a few years (and then they can call you back anytime for another few).