It seems enough to replace the lines:
let Services = globalThis.Services || ChromeUtils.import("resource://gre/modules/Services.jsm").Services;
Cu.import("resource://gre/modules/FileUtils.jsm");
By:
const { FileUtils } = ChromeUtils.importESModule("resource://gre/modules/FileUtils.sys.mjs");
But since I am not a javascript programmer, I am not sure if something more can be removed, or if something is missing.
The answer was found while reading: https://developer.thunderbird.net/add-ons/updating/tb128