Because online is global, and you can't have effective local laws against a global system. Parents don't need magic; they just need to watch what their kids use devices for, and keep the devices in public areas of the house.
The main thing the state can do is stop requiring kids to have portable internet-connected devices for state schooling.
You are obviously not a parent. I lock down devices, lock down my network, then the public school gives my kid a laptop with access to nearly everything I’ve tried to filter. Even if I can successfully monitor it at home, the device is in their possession and out of my control as a parent for 6-8 hours a day. The government is literally bypassing our family rules and my ability to protect my children in the way I see fit.
For 90% of kids, that’s not going to be an issue and everyone can feel like they’re such a great parent. But for another group of kids, they absolutely cannot handle it and have not developed the executive function to be able to manage access to everything the Internet offers.
In the past we understood this as a society. Broadcasters on public airwaves had standards for what was appropriate. We’ve completely thrown those out in one generation and decided gambling, porn, extremely violence, social and emotional grooming and abuse, and lots more are all OK to give children access to, unchecked and with limited education. It’s really kind of sick.