I stumbled across this issue when looking for a fix for #8618 but i think it would be useful for a lot of other stuff too
for example detecting the enchanted item after the enchanting dialogue was closed (in 'disenchanting')