Prevent .onmatch from being called if an assertion is generated in the dialog

@seanmonstar or @shane-tomlinson, mind having a look?

Shane's old fix from months ago, rebased against current dev & reopened. This fixes #3170 for me locally, and all tests are passing.