This is too vague to be helpful - where do you suggest an Undo button go, what should it do, how should it work?
I thought of it too. When you accidentally hit the wrong button and at the same time realize what you did, you could in a few second turn the action back, undo the choice, so that no real edit is done in Wikidata in the end. I think in Gmail there is an experimental feature of sth where you can call the email back in a few seconds if you had pushed the "Send" button to early. It would mean that the game postpones the actual edit for some time in case you would like to undo it.
Undo as "I want undlo changes in previous article" can be usefull
but sometimes also button "I want to return to previous article" because we press "I don`t know" and want to change to correct gender
I think a combination of both Piotr's and Adeliine's proposals would be ideal: the game could apply a delay of a few seconds before performing the edit, and we would have a "return" button that brings back the previous item, with the choice we previously made highlighted, so we could revise the choice. With such a system in place, there wouldn't be a need for a button that automatically performs an undo.