You can use a **message bus** subscription to do that.

The following script will call a function when *'use_keyframe_insert_auto'* is changing from the UI.

The principle is:

- Obtain a subscription link using `path_resolve` on the scene
- Then use this link to subscribe in order to fire a function when the value changes

Here is the code (look at the console to see the printed results):

    import bpy
    
    #The callback when use_keyframe_insert_auto changed
    def a_callback(scene):
        print( scene, "use_keyframe_insert_auto changed" )
    
    def subscribe_to_scene(scene):
    
        #Get a rna subscription from the scene
        subscribe_to = scene.path_resolve("tool_settings.use_keyframe_insert_auto", False)
    
        #Effectively subscribe to the rna path from the scene
        bpy.msgbus.subscribe_rna(
            key=subscribe_to,
            owner=scene,
            args=(scene,),
            notify=a_callback,
        )
    
    subscribe_to_scene(bpy.context.scene)