That requires cooperation, but since most adult websites don’t want children to be visiting them, cooperation shouldn’t be hard to get. Governments can pass a law and businesses can set a config flag. For uncooperative websites, child-locked devices can check a blacklist.
Then it’s up to parents to make sure their kids only have child-locked devices and for stores to not sell unlocked devices to kids. It’s never going to perfect, but it doesn’t doesn’t have to be to change community norms.