Ok, I understand why you are confused about this.
Please let's first understand how the elder wand works:
the wand must be taken from it's owner against their will. This does not mean that it must specifically be disarmed. It can be snatched, summoned, taken after killing, stolen while dueling or any other way of taking the wand against the will of the owner. Grindelwald stole the wand from Gregorovitch, and I guess fired a spell in order to win the allegiance of the wand. Dumbledore won the wand by dueling and defeating Grindelwald. Now, Malfoy disarmed Dumbledore, thereby taking the elder wand away from its owner without their will. Snape killed Dumbledore, but this was pre-decided. Which means, that even before Dumbledore's death, the elder wand now belonged to Malfoy. So he was the owner of the wand.
Now neither Harry, nor Malfoy ever touched the elder wand, yet became its owners. So I am guessing here that winning the original wand from its owner would grant you allegiance to all their other wands. So, Harry won Malfoy's hawthorn wand. This means he also won any other wand that had their allegiance given to Malfoy, which happened to be the elder wand.
Now it happened several times in due course that Harry was parted with his wand. But it always ended up with him having his wand back. That means Harry's wand was never taken away from him. He always had it, in the moleskin pouch. Therefore, no matter who disarms Malfoy after Harry had taken his wand, it would not make any difference to the allegiance of the elder wand. Because it now belongs to Harry. So anyone wanting the elder wand must now win Harry's wand.
I hope it makes things clear to you. I am ready to edit or add to this answer any more doubts you have.