@alexwiw There are no SharePoint out of the box ways available to hide the Share button from SharePoint site modern experience.
You may have to use custom solution like SPFx and custom CSS. If you want to hide it from specific/single site page use modern script editor and If you want to hide it from all modern pages, use SPFx application customizer.
Note: DOM manipulation & CSS customizations are not recommended by Microsoft and some of your customization may break if Microsoft changes HTML element id/classes in new release updates.
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.