The actions are legal, in the sense they have been approved by the Supreme Court. We can argue about the morality of the Supreme Court deciding on the legality of their own actions, but in practice, they are, by all means, legal.
BBC has a decent article that estabilishes a critique of the same points you mentioned in your post: https://www.bbc.com/portuguese/articles/c4n3wklk255o some of your complaints are quite fair, some don't.
In particular: "The Brazilian constitution specifies that the Supreme Court can only judge those with “privileged jurisdiction" isn't true at all. The Brazilian Constitution states a whole bunch of attributions to the Supreme Court, which you can read (in Portuguese) at:
https://www.planalto.gov.br/ccivil_03/constituicao/constitui... (search for "DO SUPREMO TRIBUNAL FEDERAL")
The role you mention, about ruling over "privileged jurisdiction" is one of 20+ attributed roles, a small fraction of their attributions.