Is it possible to create a function that is performed on the render engine change?
Use the msgbus

There is a relatively new and mostly undocumented feature of blender that fires a callback when a property is changed.  Check if your version has this feature in python console.

&gt;&gt;&gt; bpy.msgbus
&lt;module 'msgbus'&gt;


Related

https://developer.blender.org/P563

Origins to the down of the object by default

How to get an event when an object is selected?

For this case (IMO) can substitute context.scene.render.engine for context.engine

&gt;&gt;&gt; C.engine
'BLENDER_EEVEE'

&gt;&gt;&gt; C.scene.render.engine
'BLENDER_EEVEE'

&gt;&gt;&gt; C.scene.render
bpy.data.scenes['Scene'].render

&gt;&gt;&gt; type(C.scene.render)
&lt;class 'bpy.types.RenderSettings'&gt;




Use msgbus to invoke a callback whenever the "engine" property of bpy.types.RenderSettings is altered.

import bpy


handle = object()

subscribe_to = bpy.types.RenderSettings, "engine" 


def notify_test(context):
    print("Notify changed!", context.scene.render.engine)

bpy.msgbus.subscribe_rna(
    key=subscribe_to,
    owner=handle,
    args=(bpy.context,),
    notify=notify_test,
)

bpy.msgbus.publish_rna(key=subscribe_to)


Note using bpy.types.Context, "engine"  does not work.

For versions without msgbus

Can use a depsgraph_update_post (or prior scene_update_post) handler.

import bpy

engine = bpy.context.scene.render.engine

def engine_change(scene):
    global engine
    if scene.render.engine != engine:
        engine = scene.render.engine
        print("changed", engine)


if hasattr(bpy.app.handlers, "scene_update_post"):
    handler = bpy.app.handlers.scene_update_post
else:
    handler = bpy.app.handlers.depsgraph_update_post

handler.append(engine_change)