To some extent, this just sounds like willfully digging your own grave and then complaining that you're being buried. Sure, a shitty person can still do good research. But people are people, not computers. If you want to sacrifice your own social status by collaborating with a
persona non grata then that's your choice, just don't be surprised when you lose friends and professional opportunities because of it.
For a rather long take from someone within the astronomy research community, I can recommend Dr. Angela Collier's video on the topic of sexual harassment and assault in Astronomy and Physics [1].
"Here's 26 people who decided it was fine to author a paper with this serial sexual harasser ... How can I see a future in a field where people are just fine working with sexual harassers. They don't care about the women, the victims, they just care about how this person can help their career."
[1] https://www.youtube.com/watch?v=8DNRBa39Iig She discusses Geoff Marcy at ~35:30 btw.
"How can you write a mentoring statement when 66% of your students have left Astronomy directly because of you?"
***
For a much more extreme historical example, see the tragic life of Nobel laureate Fritz Haber. A man who arguably saved billions of lives with the invention of the Haber process, but who was ostracized by many fellow scientists for his work on chemical weapons during WWI.