How does excluding that person ensure that they won't use the fruits of your labor for an effort that will you cause you harm? If you think
that was the ultimate reason for them to work on the same thing as you, they can still make use of your work indirectly. If you think that they are not just a one-dimensional character, and just happen to enjoy some of the same things as you; then excluding them deprives them of that enjoyment, but it doesn't really help you, does it?
Your second paragraph seems to assume a fixed number of developers working on a project, and in that case there is no downside in replacing them. But what about an open-source project where they keep sending PRs for bug fixes and features that all have technical merit? Would you ignore that and redo the work? If I'm working on the same project, should I avoid merging their work to accommodate you?
While I agree that a community where everyone can feel comfortable is something to strive for, I think that does not require excluding some members for the views they hold. It is enough when they don't push those views onto the others.