So the issue is that jQuery is handling <script> tags in document fragments separately from other tags. The <script> tag is not being included in the document fragment, instead it's being added as a separate fragment on the jQuery object. So the returned jQuery object from $('<div><script>...</script></div>') is actually the equivalent of $([ $('<div />'), $('<script>...</script>') ]). Since there are two elements in the jQuery object, a dialog instance is created for each.
To fix this issue, just change your instantiation code:
$(dialogContent()).filter('div').dialog(dialogOptions)
.end().filter('script').appendTo('body');
This way the outer DIV is part of the dialog, and then the script is added to the body and executed.