Prior to the current administration at least, staying in government work for an entire career was more than possible and let's be clear: tons of people do stay in these jobs. Not every government lawyer, SEC employee, etc. goes over to the "dark side".
The problem is not that there is no ability to stay in public service; it's that the financial rewards of going to the other side can be massive and for the most ambitious and money and power-driven, this is a problem because the system isn't nearly as resistant to corruption as Americans would like to believe.
People with intelligence, skill and drive can use public service as a path to lucrative opportunities working for companies and organizations that are diametrically opposed to the public interest.
> Major law firms often take cases from both plaintiffs and defendants in whatever fields their specialize in.
This actually isn't really true in the way you're suggesting. For example, you won't find firms that handle consumer class action defense filing class action lawsuits on behalf of consumers, you won't find firms that sue employers over wage and hour violations also representing employers, etc.
That's why firms in these markets are known as "plaintiff-side" or "defense-side" firms.