It is not that people within governments are bad at optimizing social welfare. It's they're not trying to do so any more than any of us do. All those people have aspirations of their own and respond to changes in the opportunities and difficulties they face as much as the rest of us do.