I suppose when someone drew their attention to the fact that a crime had been committed.
At that point, they could have said "Sorry, the law doesn't protect children from crime", but that wouldn't be true. Or they could have said "Sorry, the law doesn't hold children accountable for the crimes they commit", but that wouldn't be true either. So I guess they did their job instead.
If this means that some racist bully gets what he deserves, then this is a small price to pay for the rule of law. Indeed, I must confess, I can't really see it as a downside.
Based on a news report and not knowing the specifics it is hard to say anything definite.
But given that the boy being charged is ten years old he may not even yet understand what it means when you use racial insults specifically. When I was ten I sure didn't understand that. Insult was an insult. If a kid hears an insult he is likely to repeat it if it seems effective. He hears the word '******' and sees how some adults react to it and figures: "Hey, thats a good one I'll use it at school." And uses it without fully understanding all the implications.
The other thing that we don't know about is the context. Was the kid just a racist bully or was there somekind of mutual feud and the kid used whatever insults that proved effective.
I don't know if the people involved had tried other measures before and restorted to court as a last resort, which it should be.