Can a snap be used to remove another snap?

I am looking for a solution to return my Ubuntu Core 18 thing to a “factory” state, in case things get screwy on the device itself.

I was wondering if it was possible to create a snap, that would remove all the other snaps in the system (other then the Core parts) and then re-install those needed?

Also open to ideas on how to have a Raspberry Pi, Ubuntu Core have a factory refresh function as well if there is a better way.

The snapd-control interface provides access to the privileged snapd rest API over a socket. Use of this interface is typically only for snaps in brand stores.

additionally to what jamie said, i believe a factory reset feature is on the roadmap for UbuntuCore20