It's not about serving them. They have already been served multiple times, refused to comply, got fined and refused to pay the fines. Pulling out their office was simply a means to avoid paying fines, that's all. There's no big motive there but cash.
One can argue about the politics of this all day. There are political views to be discussed about the morality of the requests to ban accounts versus the morality of keeping the accounts online, but the law is the law. If you want to operate on a certain country you need to abide by that country's laws, there aren't really any exceptions anywhere in the World.
Lots of platforms operate in Brazil without a legal representative, the country is actually very lax about that. There's no Substack or Medium office as far as I know, and I'm writing this comment on Hackernews without any issue. Generally, the legal representation is only required when someone takes legal action against the platform for some reason.
Obviously larger platforms like Twitter, Instagram and their likes have lots of legal actions in local courts. They also collect a shitload of ad revenue from local companies, and in both cases they are required to have a local representation. Twitter has laid-off all their engineering and marketing in Brazil when Musk bought it, and just recently decided to close down their legal and finance office to avoid paying the said fines. Whatever the political stand-off that brought them to this, there's no reasonable justification to stand with Twitter now.
"I don't aggree with your laws" is not a valid reason for a company to break these laws in any country, for any law.