I ask because the more I think about Mary, the more frustratingly turned around in circles I become, and no matter how I try to read the Appledore scenes at the end of that episode, I can't see it turning out well for the show - I go back and forth between thinking Sherlock is taking on Magnussen because it's in Mary's best interest, or thinking that he's doing this as a way to appease her, or thinking it's part of some grand plot to take her down, and no matter how I turn it around in my head there are always fairly large parts of that chain of events that simply don't make sense to me.
Which has me wondering if the scene isn't really about Mary, if there isn't some other motive that's driving Sherlock's actions here. I've been playing with a few in my head, and the theories get (IMO) more plausible if you place Mary on the periphery - if for instance he's acting as an operative on Mycroft's behalf, or if he's trying to get John free of being a pressure point that would be used against Mycroft, trying to keep John from being a pawn. And I'm not completely convinced yet, but it does seem suggestive that the show takes its title from the one Doyle story where Holmes works with the government more closely than any other I can recall.
Of course, I'm a Mycroft fan so it's just possible I'm seeing connections that don't exist because they bring my favorite character to the center of things. And of course Doyle connections can be thoroughly tangential when Team Moffat wants them to be - they're certainly not shy about turning the canon on its head. But I was wondering if anyone had seen discussions on this connection or had thoughts they wanted to discuss, to help spur on my own thinking here.