(Be forewarned: spoilers for "His Last Vow" and series three generally ahead.)
This isn't a problem limited to the Sherlock fandom, by a long shot. I saw the same thing happen in the Tolkien fandom, particularly in slash though I'm sure it could happen in het contexts as well. What typically happens is the author sees a certain connection between A and B and wants to explore it, but B already is married to C, or has a serious canonical relationship with her, something along those lines. Said author isn't interested in a one-night affair or a boyfriend on the side; she wants A to be the love of B's life. To make this seem less like a math equation, let's focus in on the John-Mary-Sherlock triangle. You want to get John and Sherlock together as the true love in each others' life, but now John's gone and married Mary. Oops!
This isn't an abstract problem, btw. For all that I complain about some Sherlockians being defensively anti-Johnlock (Johnlock=John/Sherlock slash), that's my experience rather than what the fandom is actually interested in. There are a lot of fanfic writers who want to write this relationship romantically, and when it was announced that John was getting married in the upcoming series, quite a few of them took it as a threat to the Johnlock relationship, which isn't canon but is supported by subtext that sometimes seems so thick, you should be able to cut it with a knife. Some of these fans, a very small minority as far as I can tell, have gone overboard and lashed out at Amanda Abbington (the actress playing Mary and Martin Freeman's RL partner). She even received death threats and certainly there's been animosity toward her in certain circles. Personally, I love what I've seen of her, onscreen and off. I think she's lovely, and I get that she's just an actress playing a role. People who lash out at her for threatening their "'ship" are just a little overinvested.
But I do get the problem those Johnlock fans are reacting to at some level. Whenever you have two characters you want to write in a romance, when the canon creators put one of those characters in another relationship, that's something you have to deal with. And honestly there aren't that many options.
1. You can integrate. If you're at all drawn to polyamory, John/Mary/Sherlock can be a lovely possibility. It can also be complicated, and some people will either have a moral problem with the whole idea, or they just won't have the experience to write it competently. Whether it's true in fact or not, a relationship between three people would certainly seem emotionally different from a relationship between two, and for I think quite a lot of Johnlock authors that's just not the kind of story they're drawn to write.
2. You can segregate. Depending on the situation, some writers can plausibly write the wife as simply not caring or even giving her blessing to the situation. If Denethor's and Finduilas's marriage was a political match, she may not be too opposed to Denethor starting up something with Thorongil on the side. She may even approve of it, and have no problem with her husband forming his primary emotional and sexual connection with someone else entirely. It works significantly less well in contemporary settings where there's not so much pressure to start or continue in loveless marriages. The problem with the Sherlock situation is that John seems to truly love Mary, even after he learns about her true past (more on that in a minute), and Mary is quite literally willing to kill to hold on to John. I can't see her being too keen on sharing. It's doable in theory, I suppose, but would require a good deal of work to make it seem plausible.
3. Which leaves annihilate. If you don't want to fold Mary into this relationship, and you can't see a way for Mary to plausibly let John take Sherlock as a lover, then you have to remove Mary from the equation. You stash her in witness protection, never to be seen again. You kill her or force her into exile. You make her an old shrew who is so domineering, John basically checks out on their marriage and takes up with Sherlock, without her approval and without any real effort at preserving his relationship with Mary. The point is that you somehow make Mary a non-issue. And, because you may not like Mary all htat much, you'll probably do it in a violent, painful way. (Bonus: fre hurt/comfort.)
I'd say the third option is by far the most common. Couples get together because one of their spouses has basically disappeared from the picture. This seems particularly tempting when you're not driven to like the particular character in quesiton.
Now, in the first two episodes of Sherlock series three, Mary is charming. She plays a big part in getting Sherlock and John back together as friends, and then there's the wedding episode where she and Sherlock really bond over wedding planning. She even sets John up on a playdate where he and Sherlock go out and solve crimes together, like old times. It's so sweet it will give you a toothache. But really, it's very charming.
Then we get to His Last Vow. My first reaction was a common one from what I've heard: What. The. Heck?!? Basically it's revealed that Mary's a CIA-trained assassin who then went "freelance." We don't know what made her pass paths with John. We don't know what made her stop, if she stopped. We do know she shot Sherlock in a dangerous enough location that he went into cardiac arrest and threatened him multiple times if he told anyone about it, and that she only came clean after John saw her basically admitting all this to Sherlock. We don't even know her real name. She's manipulative. Violent. A liar.
There are mitigating circumstances I could dream up. On the medical angle, wellingtongoose has made an interesting case both for why Mary never intended to kill Sherlock, and why the location of the shot gave him the best chance to live. But that, along with my own sense that Mary is not so irredeemable as she seems in HLV, is a fan's interpretation. Other fans may disagree in good faith. I may be drawn to kinder!gentler!Mary, much as I've been drawn to KG!Denethor over the years. But I'm not so blind to see why some people wouldn't think Mary's a particularly dark character who's simply not worthy of John. That John's attraction to her is a combination of his being an adrenaline junkie combined with the fact that all this is happening while she's carrying his child, giving him a very good reason to keep things together at least until the kid's born. Those are also valid, possibly very interesting interpretations of the canon we saw in HLV.
Add to that the fact that John truly does seem to love Mary. He reconciles with her, seemingly genuinely, and has one of the most romantic lines (on its surface) in the series to date: The problems of your past are your business; the problems of your future are my privilege. Mary (again, seemingly) gives him the documents related to her true past and he doesn't even look at them. Sherlock is so driven to protect her --after she shoots him!-- that he murders Magnussen in front of dozens of policemen, knowing that he'll go to jail for a very long time, at best. This is Sherlock, the man for whom boredom is so intensely painful. Going to jail like that is a form of suicide, or at least of martyrdom. And he does that because John chose Mary. Twice, actually.
So the segregation issue seems increasingly implausible to me. Mary is not the kind of woman to want to share John's affections willingly, and John makes it quite clear that he wants her to be the center of his life. The segregation strategy might work in the hands of the right offer, but it would take a fair bit of skill and work. So it's not so surprising, given how dark Mary's character becomes in HLV, that a lot of people are drawn to take Mary out of the picture entirely. She is evil; she isn't worthy of John; she must somehow be removed from the picture. Most likely in a way that will make her look bad or is in some way her due justice for all she's done in the past, to John and other people.
Now, it's one thing to look at Mary's character as it was portrayed in HLV and say she is irredeemable; that she is simply too bad to be a suitable match for John. John's supposed to be the moral heart of the show after all, and this is the mate he chose. What worries me, and what I've seen in a few fanfics already, is a drive to demonize Mary beyond what her character deserves. It's one thing to give a careful analysis of her character and hate her based on that, and quite another to use this morally bad character as an excuse to just remove her from the picture entirely to make room for Johnlock.
What's wrong with that? It's too easy, for one thing. It doesn't do justice to John's obvious love of Mary and the fact that Sherlock is quite willing to sacrifice his life so that Mary and John can live happily ever after. The annihilation approach can be done well, but you need to put in the work and make it plausible how Mary is no longer to be a part of John's life. This is a basic respect for canon and the fact that both of the characters you want together were willing to make huge sacrifices to protect John's relationship with Mary. Slashers have a long history of hating the woman who threatens to come between them, but that's not a good enough reason to write the woman out of the picture as if she never existed, of resenting her so much we want to annihilate her. That's tempting enough even without all of Mary's flaws (I mean look at what we do to Sally because she lashes out at Sherlock; Mary shot him). But when we do that, particularly when the relationship is so meaningful to both characters, we have to ignore a big portion of who they are. The fic becomes not only less interesting but less authentic.
There's another problem with this approach, though: it's anti-feminist, or at least it's entirely too easy to cross into misogyny. Set aside the question of whether Johnlock denigrates the value of Platonic friendship (not necessarily, IMO), and just look at what slash says about the women involved in these characters' relationships. We take away their beloveds and give them to another man, and that means we walk women out of the picture. Which isn't bad in itself. Homosexuality and bisexuality mean that sometimes women lose their lovers to men. But I think we have to realize how that kind of move takes away a major role women have often played in stories. We are not just prizes to be won or damsels in need of rescuing, which is great! But if we simply turn them into an evil caricature of themselves, or if we quite literally have them exit stage left? In many ways that's worse than the previous marginalization. It's eradication.
This doesn't mean there's no room for Johnlock after series three. Each of these three options have problems associated with them, but they also have real potential to do something quite interesting. In another post, I talked about how I really want "the functional equivalent of polyamory, a full sharing of John's affections and time and activities" between Sherlock and Mary. In an ideal world Sherlock and Mary would be drawn together, too. While I don't necessarily need a sexual component between all characters, I think if you're drawn toward that, there's room to write a really interesting fic that brings all three together in a way that honors the love (romantic or otherwise) growing between all three character pairs. Or if you prefer to write John/Sherlock and John/Mary as completely separate but simultaneous relationships, or want to take Mary out of the picture entirely, there are probably ways to do this. It will just require some work to make that plausible. I'm not so concerned about people who kill off Mary (figurtively or not) in a way that actually honors her relationship with John; I'm much more concerned by the folks so driven to hate Mary that they'll let that become their excuse for writing her off.
But what really worries me is the possibility that Mary's morally gray (at best) character will match up with the strong feelings many slash writers have against the woman who comes between the characters we want to ship. Mary, even assassin!Mary, is a really interesting character and she deserves better.