But that's not what laws like these are about. In the US at least these laws are driven by Christian Nationalists are setting up a situation where PII of porn users is able to be leaked. That's what they're counting on. They also want to have political control of platforms by continually holding a Sword of Damocles above any publisher's head.
It's possible to do truly anonymous ZKP's of being a member of a set (eg. over 18s) but in practice it would be very cumbersome. It would involve having a setup with a central authority (government) to build a Merkle tree where users would submit hashes of randomness and then a user would generate a token through a ZKP that would decouple them from their real identity with the anonymity dependent on the set size. New participants can be brought in but the anonymity set sizes would fluctuate.
Even with this method it will link together all services utilizing the token. And if you attempt to solve this by allowing to generate multiple tokens the entire scheme becomes somewhat meaningless as durable bypass services would emerge.