Federal government can pay enough to get software engineers. FAANG salaries are an outlier. They could easily target some midwestern state, put the headquarters for federal software agency there, find a feeder school, and get employees fed to an agency making a comfortable 6 figures in a low cost of living area. Will there be some attrition? Sure. But plenty will stay cause thats where family is, and where they have their house, and thats where there kids go to school and etc.
I can guarantee you that the contractors they hire from Accenture and IBM are using devs that arent making FAANG salaries. Its kind of a meme how bad some of the government contractors are, its pretty well known you can just be a body that sits at a desk if you can get a security clearance and make easy money just manually running an SQL script once a week on some of these government contracts.
The real reason nothing gets fixed is because the federal workers get free salaries and benefits packages that far outstrip their value that oversee these projects, and the contracting firms get easy money.