masochism by proxy
To be excited by the object of ones unrequited desire's cruelty to loved ones or third parties as a means of personal subjugation.

To enjoy the cruelty of the powerful over the powerless when powerless yourself.
When the one you can't have insists on being cruel to the one you've got, and you cum in your pants? That's not even masochism, it's masochism by proxy.