My issue with masturbation in The Whale is it not the masturbation itself, per se, but the way the scene seems to invite disgust. As I said in my review, I think the film has a self-contradicting message, and I just don't buy it as a coherent drama.
There are other masturbation scenes in films that have dramatic merit: Midnight Express, for example, when Billy is visited in the Turkish prison by his distraught girlfriend Susan. After years of gang rape, crap food, brutal violence, and seeing nothing but resolutely male inmates, the sight of her is too much, and he masturbates, begging her to take her top off. She obliges, and tearfully presses herself against the glass, saying "I wish I could make it better for you." I can't think of another masturbation scene I'd consider deeply moving, but that one is.
Then there's the scene in The Babadook where grieving, desperately lonely, and deeply troubled Amelia gets out her vibrator, only to be interrupted by her young son (yet again) complaining about their scary supernatural intruder. Again, the scene has dramatic merit.
I could think of several more examples, but I'll leave it there. :)