Hi @equitax,
In cases where there is an MDM profile locking the ability to factory reset a device, you should be able to still perform a "Hard Reset" by utilizing Recovery Mode on the Android device. From the Recovery Mode menu, I believe you should be able to perform a wipe/factory reset, which will bypass the restriction set by the MDM.
I'd recommend searching online for steps on how to perform the "Hard Reset", and see if that works for you in this situation.