I actually tested myself...
Inserter: Does it wrong.
Empty: wrong
blueprint: Correct
Other item: wrong.
I'll have to look into things, but considering I set it on player places item specifically, pressing undo must trigger the same event, meaning even if I filter it specifically to ghost_type == hand.item_type, it'll still do it wrong if you're holding the item that undo restores.