Interesting issue, you might want to consider make a fluid wrapper around the dialog widget. In this way you might be able to retain a reference to the widget itself. You can look at some recent work @amb26 has been doing on updating our tooltip wrapper https://github.com/amb26/infusion/blob/FLUID-5185/src/components/tooltip/js/Tooltip.js
It could be that the situation you have here is a special case though. Let me know how you get on with this.