As you have found, 3D Raycasting (Physics.Raycast()) on a 2D colliders does not work. You have a couple of choices. First Monobehaviour.OnMouse* functions do work, so you can put a script directly on the object. If you want to Raycast(), then an alternate solution is to put a 3D collider on an empty child game object and size the collider as appropriate to your sprite. You can use the Transform.parent to access the sprite.
If anyone else comes across an issue like this and like me couldn’t get anything to work, what I did was basically what @MarcosLC suggested with using 3d colliders. None of the other suggestions here or anywhere else worked, not even the obvious routes like using the Physics2D options, Physics2D.GetRayIntersection, or eventsystem.current.etcetc…
I needed to check both a 3D object and a button element at the same time, and no matter what I tried nothing worked, except this:
Used 3D box colliders for button elements instead of 2D, and in the Canvas set the Render Mode to Screen Space - Camera and set the plane distance to 1. It’s not perfect, but at least it allowed me to keep everything in the same space and reduce complexity, and you know, actually work. So after all these years, thank you, @MarcosLC.