It’s okay to have fictional characters do problematic stuff. Really, it is. Fictional characters are there to tell a story; not to be perfect paragons of virtue.
“Yeah!” some people will say. “It’s fine as long as you show that it’s problematic!”
And I’ll say: No. You don’t need to always do that either. We can’t expect writers to point out every moral misstep a character makes.
It’s okay to have characters do something problematic, and it’s okay to assume that the readers can see why it’s problematic on their own.