It’s actually pretty simple. There’s a global value in the database called installed_apps - it’s in the sequence of installation. Every time an app is installed, it gets added at the end of installed_apps.
The sort parameter to get_installed_apps needs to be deprecated - it’s not ideal for multi-tenancy (see attempt).
To move your custom app to the end of this list, you can just execute the following code in bench console:
installed_apps = frappe.get_installed_apps()
installed_apps.remove("your-app-name")
installed_apps.append("your-app-name")
frappe.db.set_global("installed_apps", json.dumps(installed_apps))
frappe.db.commit()