Legally it's impossible. Cartridges are read only, once written cannot be rewritten. To write empty cartridge you need to make empty cartridge, hardware and tool to write to it and additionally figure out how to sign image so Switch will recognize it and it will pass checks. This is possibke only by stealing from Nintendo.
--------------------- MERGED ---------------------------
XCI mounting outside of cartridge* XCI loading is done via system.
Because it's done via system.
XCI is just a raw image of cartridge.