How do I disallow screen sharing for Messages?
Not exactly an answer, but reading documentation: Share screens using Messages on Mac I noticed:

You can’t send a message to someone who’s restricted by communication
limits in Screen Time.

And:

Tip: Don’t want someone to send you screen-sharing invitations? When
you receive an invitation from them, hold the pointer over the Decline
button, click the down arrow, then click Block User.

It should be possible to restrict your child (or yourself) with communication limits (Set up communication limits in Screen Time on Mac) and this way disallow screen sharing. Whether cost of doing it is too high is another story.