The way to avoid this kind of BS is to put your kid in magnet/private schools where they will be encouraged and supported rather than arrested.
Normal teachers and normal schools are not equipped to deal with the challenges (and victories) gifted students present. I know this from both sides of the classroom desk. And a subset of “normal” kids will bully your gifted kid. Do you want that?
Fear has made us automatically suspect people who can actually make things with their minds and hands. “Gotta be a hacker! Gotta be a criminal! Gotta be a terrorist!”
Example: the word “hacker” doesn’t mean what the uninformed public thinks it means. A “hack” is a clever solution to a problem, particularly a solution that requires a deep understanding of the thing to be hacked. A hack improves the product for some particular use. A “hacker” is one who hacks. That’s it. Does your kid disassemble stuff, change it, and reassemble it? Do you modify off-the-shelf items to make them fit your needs better? Congratulations, hacker. I hope the police don’t come to your house, kitted out in black paramilitary gear and driving military surplus vehicles, shooting your dog.