If a child parrots hateful speech, it's usually because they've been taught it at home. Children are constantly absorbing information and attitudes from the adults around them, for better or worse, so if you see one bullying other children - it's likely because that behavior is normal to them.
Luckily, just as children can mirror toxic attitudes, they can also learn and absorb loving attitudes, so as adults it's our collective responsibility to help teach and guide them on their way towards healthy adulthood.
However, this can be tricky if they're someone else's kid, even moreso if they're someone else's kid causing harm to your kid. In those situations, opinions vary on how to broach the topic of discrimination and bullying, and you can find yourself in a catch-22 of sorts.
AITA for how I spoke to a kid bullying my son? She used a slur and I talked to her about the bad history of the word.