Many users do not desire to interact with underage users for many reasons. Some underage users may wish to opt out of seeing 18+ users so they may bond with people closer to them in age or perhaps for safety. I think a functionality to
- mark your account as 18+
- hide content from accounts who didn't mark self as 18+
- hide content from accounts who marked self as 18+ would be very useful to those users and set a higher standard of personalized experience for users engaging with social media.
What you're describing is only possible on de-anonymized platforms that essentially have "know your customer" type policies where users have to provide some kind of proof of their identity. While I agree that there is value in social spaces where everyone generally knows the people they're interacting with are who they say they are, I don't think this is ever going to be feasible in a federated social platform. I think Facebook is the closest thing we have to what you're describing, to be honest, and I believe Meta has even kicked around having a more sandboxed Instagram for minors (though I don't use Instagram, so I'm not certain on the details there).
For me, in most cases on a platform like Lemmy, a person's age is not something I care about. I care about what people are sharing and saying. But then again, none of my interests for online discussion at this point in my life are really age centric. I think there are clearly better platforms than Lemmy if people want to guarantee they're only interacting within their age specific peer groups.
You don't need users to prove their age for it to be effective. Some people will lie, but the majority will probably tell the truth. You'll probably want stronger protections for something like a dating site, but I can still see value in something like Lemmy.