It would probably also be illegal for the government to mandate a paywall.

The issue is not that age gates are illegal, but that the government forcing people to use age gates is illegal.

But there are already laws that, for example, restrict children from buying pornographic magazines. These have been found by the Supreme Court to be constitutionally compatible. I don't see why this would be different with similar laws that apply to online services.

Generally speaking, things that you sell (the legal term is commercial speech, iirc) is more able to be regulated by the government.

The government can ban the sale of those things to minors, generally. So the category of porn sites that require a credit card and pay gate the content might be regulateable.

But that's not how places like pornhub or xvideos operate