This is a great idea ( I sincerely mean it), and I too have been toying with this.
Gov programming jobs are also very cushy. The knock on them ( / "cons" ) until recently was that they pay very less, almost 40% less, and that it's full of old people. But that has changed -- atleast in San Francisco and Bay Area where I live.
Esp the City of San Francisco tech jobs[1] are quite interesting and many use modern tech. On top of that almost all Govt jobs accrue pension at the rate of 3% of your gross / year, so if you work 17 years or so you can get 50% of your highest salary at retirement.
The con I see is that the process to get hired is very tedious and involves lots of applications and moves very slowly. I was plesantly surprised to see Sr. Software Engineer jobs that were paying anywhere from 110K to 130K [2] -- all govt jobs have to disclose salary or rate range in JD --, which is not to far off from the average in this area for non-FAANG / non-Startup type job.
[1] SF City Tech Jobs => https://www.jobapscloud.com/SF/?Keyword=&Loc=&DeptNumber=&Oc...
[2] Source / Example: IS Programmer Analyst Principal: Notice salary Range of $105,794 - $133,094/yr in desc. https://jobapscloud.com/SF/sup/bulpreview.asp?R1=PEX&R2=1064...
Now, if you're including the TSP (401k equivalent), maybe? That's 5%/year extra if you also contribute 5%. However, that's what you and the government put into the account, not what's available when you retire. Perhaps it works out to close to 3% average with some estimate of your TSP earnings? I never crunched those numbers.
Government salary ranges can be found at OPM. Look up the GS pay scale. Programmers will be GS-12 to GS-14 positions (most likely 12 or 13, 14 if you're a true subject matter expert, have a Phd, or maybe work at the right facility, otherwise 14s are management).
Still, if you assume something like a 4% return (maybe comparable to the bonds behind them?), that 1.1%/year amounts to another 27.5% on top of your gross pay.
And that's not considering the likelihood that you'll be earning more at the end of your tenure than at the start. You're effectively earning that significant fraction of your final pay on top of whatever you see in your pay check.
So if I work for 20 years and have an average of 100k for my high 3-year, I'm getting $20k/year for the rest of my life.
In the same circumstances but I retire at age 62 (leave work at age 62), I get $22k/year for the rest of my life.
The current President is also talking about eliminating the cost-of-living adjustmetns that have been typical (intended to keep with inflation) for retirees, and changing the 3-year average to a 5-year average.
The other number I gave (5%) is a matching contribution to the TSP (401k equivalent), that is cash given each year and will add up to something more substantial. Even assuming a modest 4%/year return over 20-30 years of contributing.
The only reason I got into web dev were what it offered me as far as ability to make things. But the work itself? I'm just as happy writing reports vs refactoring a test suit. Rails makes software fun for me, I would not have gotten into web dev if i thought React was how things are done.