I have a vague recollection that the Elder Wand is quite happy to betray its owner for a more powerful wizard.
The best I could find was a quote from screenrant:
Because this wand thinks so highly of itself, it is incredibly finicky with its ownership. This wand will only choose a witch or wizard who shows great talent and power when it comes to using magic. And if that witch or wizard does not meet the strength standards the wand has over them, then this wand will betray its owner and seek new ownership.
Is that supported in the books?