Is it necessary?
Well, you can argue that most tangential things are not directly necessary for the plot. However, that doesn't mean that they can't help paint the picture.
Although I do think that the show sometimes overly focuses on sexual scenes (e.g. the latest scene between Yara Greyjoy and Ellaria Sand felt contrived and revealed nothing new about either of their characters), I do think that there is validity in showing sexual scenes altogether.
This goes hand in hand with the displays of violence, e.g. Ned Stark being decapitated without the camera panning away and implying the beheading.
Sex and violence serve the same purpose here: they paint the world of Westeros (and beyond) as a grim world, where reality is not as sophisticated as others would have you believe.
For example, look at Sansa in King's Landing. An innocent, naive child. Wouldn't harm a fly, and is more prone to cry instead of get angry. However, when the people in King's Landing rioted, three men tried to rape her.
Did those three men care about her soft character? No. Because it is irrelevant that Sansa is such a softie. To those men, she was nothing more than an orifice that they wanted to penetrate.
I apologize for the blunt description, but it does prove my point rather nicely: there is a gritty reality in the world of Game of Thrones, and it needs to be presented to the viewer. If the characters are meant to forcibly endure this harsh and gritty world, and the viewer is supposed to follow the character's experiences, that means that the viewer must also forcibly endure these things, whether they like it or not.
Let me prove why it is necessary.
Look at this rape scene from Rick and Morty. I promise you, there is no nudity nor truly sexual behavior. I wouldn't watch it at work but it is not pornographic in any way.
Doesn't this feel much more real than when Morty would have entered the next scene and said that a jellybean tried to rape him?
I really like this scene from a cinematic point of view. It really showcases the inescapability of the imminent rape. Morty struggles and almost gets away a few times, but he gets pulled back and is victim to this seemingly inescapable situation.
There is a sense of reality. We saw it. We experienced the rape. We know what Morty went through. We were hoping that he could get away, but afraid that he wouldn't be able to. It seemed so grim, so unfair, so dark. We felt Morty's pain and fear, rather than just imagining what it must have been like.
A picture says more than a thousand words.
Is this gritty reality necessary for Game of Thrones?
My answer is yes.
Compare Game of Thrones to Lord of the Rings. Both deal with a medieval fantasy world, both focus on politics and a greater evil that warrants warring factions to work together to overcome it.
But these stories are portrayed very differently. Lord of the Rings paints a clear picture between good and evil. Although there are people who end up in a morally grey area (Boromir's mistake, Sméagol's redemption), the story itself is clear: good must defeat evil.
However, this distinction between good and evil is not as clear in Game of Thrones, and that is by intention. The good guys do not inherently win because they wear plot armor. Sometimes, entire subplots get wiped out before they have even begun to come to fruition (most notably the Red Wedding)
Compare the Batman movies from the '90s (e.g. Batman Forever) to the Nolan Batman movies (e.g. The Dark Knight). These are two very differnt interpretations of the same source material.
The older movies make heavy use of the superhero archetype, where the hero will always prevail, and rarely (if ever) makes intentional mistakes. The movies also never suggest that the hero is doing something wrong. The hero is clearly a good guy.
The Nolan trilogy, however, does away with the inherent notion that heroes are good people. It shows Bruce Wayne not only as a fallible person, but a man who carries resentment, and whose principles may not be as morally right as Bruce thinks they are.
To me, the description of the Nolan Batman trilogy and Game of Thrones always boils down to the same two words: gritty realism. It may not be pretty, you may not like it, but it is the objective truth, and you will be presented with it whether you like it or not (because the people in the story are also presented with an undeniable-but-undesired truth).
So was it necessary?
Let me break down your question into different facets:
Were all sexual scenes necessary to the plot?
No. There are a few scenes that could have been omitted.
Should the show have avoided sexual scenes altogether?
No. It would have dramatically changed how the viewers perceived the world. The shows needs to be in-your-face real (to reflect the books). It shows the gritty realism of both violence and sex. This gritty realism is quintessential to the story of Game of Thrones.
Could they have omitted some sexual scenes?
Of course they could have. They could've done anything they wanted, it's their show after all.
However, where should they have drawn the line? Because with every scene that they omit from the final result; they change the perception of the show in general. And little by little, they would be reshaping both the show, and our interpretation of both the story and the world in which it takes place.
Censorship is never a good approach. (But neither is excessively overdoing it, in your defense).