I was just searching for a similar solution.
This works for me:
In the xfmg_media_view
template, just change the condition from: <xf:if is="$mediaItem.canSetAsAvatar()">
to this: <xf:if is="$mediaItem.canSetAsAvatar() AND $xf.visitor.user_id == $mediaItem.user_id">
This way only the owner can set it's media item as an avatar.