The only problem with your counter examples are that none of them are Mary Sues. I think you’re not quite getting the core issue with a Mary Sue. It isn’t necessarily that Mary Sues are perfect and good at everything (although that is a big part of it); the real core of the issue is that everything comes too easily for Mary Sues. They don’t ever fail, or have set backs on their way to ultimate victory.
You’re counter examples are faulty because in each and every case, while the hero in question is powerful, they usually have personal flaws (Thor is a hothead ready to start war at the drop of a hat; Iron Man is an irresponsible playboy; Bond is ruthless, verging on heartless), they have weaknesses and vulnerabilities (e.g., Bond normally works alone against a large enemy organization), and they have failures and setbacks in each film before they finally overcome their external foes and their internal flaws. At points in every film, each one of these characters show weakness of one sort or another.
To turn to your Star Wars examples, with Anakin, Lucas was going for a tragic fall, so of course he was built up as a child prodigy. However, we are explicitly told in the Phantom Menace that he is unsuitable for training because there is darkness in him. As Shakespeare shows us (MacBeth, King Lear, Othello) tragic figures have to fall from a great height, so Anakin is built up in the first movie. This does not make him a Mary Sue. After all, he falls to the dark side and is thus a failure. In short, Anakin is hardly a wish fulfillment character.
Luke isn’t a Mary Sue either. First off, he whines a lot. He also struggles and fails a lot: he gets beat up by the Sand People and bullied in the Cantina, both times saved by Kenobi. Luke and Han save Leia, but they screw it up and need to be bailed out by first Leia herself, and then the droids. Luke is the very definition of weak and vulnerable in A New Hope. Out of the principle characters through the first two acts of A New Hope, Luke is depicted as the least capable with the weakest personality: Han Solo and Ben Kenobi are far more seasoned, and Chewie is terrifying, while Luke appears whiny and immature. No adversary would fear or respect Luke at this point. When Leia joins up, it is also clear that she has a much stronger personality than Luke and immediately takes charge. In these scenes, Luke is a mere passenger; others are driving the bus. In contrast, Rey rarely shows weakness, vulnerability, a need to rely on friends for help, failure or struggle. Moreover, she shows herself at least the equal of Han Solo in the inner workings of the Millennium Falcon, quickly earning the respect of Han and Chewie, and easily surpassing Finn in this and all respects.
Luke’s difficulties continue in the final act of A New Hope: in the final battle for the death star, Luke doesn’t exactly distinguish himself in the dogfight: his x-wing takes a hit, and he needs to be saved by Wedge. In the trench run it is his wing mates (Wedge again) that provide cover by risking their lives. In the final seconds before hitting the exhaust port, Luke’s x-wing gets hit again, before Vader obtains target lock on him. Luke is saved by Han Solo. Besides, the miracle of the destruction of the death star isn’t in Luke’s shot; it was in the fact that such a monstrosity could be taken down by a single x-wing fighter in the first place. [Edit: Subsequent movies prove that taking down a Death Star isn’t so very special after all: Lando/Chewie do it in Return of the Jedi and Poe Dameron does it in The Force Awakens.]
This is only in the first film. In Empire, Luke goes on to fail in his training in two key respects: failing to lift the x-wing out of the swamp and the failure in the cave. He also gets caught by the ice monster, and is rescued by Han from freezing to death. At the end of Empire, Luke loses his duel with Vader and has his hand chopped off. Even at the end of Return, he defeats Vader, only to get his ass kicked by the Emperor before Vader of all people saves Luke.
Rey isn’t a prime example of a Mary Sue, because she does have some difficulties, including getting herself captured at one point, but if we view the issue as being a continuum rather than binary, I think it is fair to characterize her as being Mary Sue-ish.