How to find the application that controls system dialog window
When you have a window that is a system dialog, or alert, type of window, and you do not know which application it belongs to, you can try using code such as the following example AppleScript code to determine the name of the application to which it belongs:

tell application "System Events" to ¬
    get name of every application process ¬
        whose role description of window 1 is "system dialog"


Or: 

tell application "System Events" to ¬
    get name of every application process ¬
        whose accessibility description of window 1 is "alert"




That said, the application process you want System Events to interact with is: CoreServicesUIAgent

For example, if Google Chrome is my default browser and I run, e.g.:

do shell script "/usr/local/bin/defaultbrowser 'safari'"


Then this dialog box appears:



To click the Use “Safari” button, use:

tell application "System Events" to ¬
    click button "Use “Safari”" of ¬
        window 1 of application process "CoreServicesUIAgent"


Note: You can also use click button 1 instead of click button "Use “Safari”".

Obviously you'll need to adjust for your particular needs/wants, but you now have the application process that System Events needs to interact with.