Governments already have systems to handle citizen IDs. They’re not perfect, and fake ones do get created, but they’re good enough. All that is needed is to connect that system to a UBI key or other device. Then websites could use cryptographic tools (signatures, ZK-SNARKS, etc) to verify that someone is over 18 without revealing their identity
It would be very stupid to set up a system where you have to give the porn site your ID. Better to just have an attestation that this user is over 18 years old.
There even ways to do this without the government knowing which site you visited with zero knowledge cryptography. But that would probably require everyone to get a Yubi key or equivalent, which might be hard to swallow