Whether or not authorities with jurisdiction over you would notice your instance (homeserver) or bother you about age verification is an issue you'd have to consider for yourself.
The spirit of the law is definitely not against chatting with friends, but it is against the idea of connecting minors with strangers, so while federation is generally not codified (or, IMO, understood well by legislators) and you're probably not going to be bothered by authorities about it, I reckon sooner or later the law will come for federated networks.
(Since we all seem fine just taking some uncertified random third party's word for it that their AI face recognition definitely didn't see a thumb with a face drawn on it, maybe it'd be adequate for Matrix.org to add an "18+ user" flag to the protocol and call it a day?)
I honestly have no idea. As much as they love money I am not paying my lawyers to research AI this one. I would probably wait for others to get made example of.