Should books require an age rating?
What about spoken words?
What makes online speech different, from the perspective of the Constitution that limits the power of the state?
You are correct.
Also, FWIW, 18 U.S.C. § 2257 applies to printed books as well as online content.
But pure text literature (physical or online) isn't as regulated as visual media.
The difference is one of redressing a concrete dysfunction. Libraries or the local bookstore or whoever aren't trying to sneak into your home, onto your child's school bus, into your child's classroom, while pushing various extremist publications purely for their own profit (ie "engagement"). We do in fact have zoning laws - I can't inadvertently encounter a strip club in a quiet residential area. Meanwhile it's commonplace for children to carry a network terminal around with them with which one can readily access the equivalent of things far worse than that.
What I've described does not restrict one's ability to speak freely. It is most similar to an impressum except it bears no identifying mark thus poses no hazard to anonymous speech.