Wouldn’t you think this would mean government-made code would be of higher quality (in theory, and ignoring when govt code is made by private contractors)? It seems to be the opposite
Governments are often sort termist too. For politicians next year's election is often what matters. They also have layers of management, in some countries they are frequently moved around so the long term (from any given manager's point of view) is someone else's problem.
From what I know academics in computing fields tend to write high quality software. Not all not Donald Knuth level, but they seem to mostly care about quality.
Not all developers are equal. Government work pays a third or less what private industry pays. You’re never going to get extreme competence from a government software employee.
Never? You don’t think NSA or Israeli 8200 has preeminent software developers? I think your assumption hinges on people being motivated solely by money. That may be largely generalizable, but I suspect there are relatively large exceptions to that rule.
I think they have the benefit of mystique. I don’t think you’d find their code quality any better than the average. I also think you’d find the same rush to market mania that plagues the rest of the software industry.
Not all competent people are driven by pay. I'd say the most competent usually are not. There are a lot easier and safer ways to get paid well than competence.