After power on or hardware reset, the SWJ pins are not active. They are activated at the very end of boot code execution, unless prohibited by the TOC2_Flags register. The timeline looks like this:
Hence, since you disabled the SWJ pins by writing to the TOC2 register, when you reset the device, the pins won't be configured as SWJ anymore and you won't be able to enter test mode. Test mode is required for performing any operations like erase or program. This is why erase operation is failing.
To unlock the DAP, the user application must toggle the SWJ_PINS_CTL value and also update the TOC2 checksum as well. You only asked about disabling the DAP in your earlier interaction, so I think you did not do this step.
If you haven't written any application code to unlock the DAP, you have no way to reprogram the device using SWJ. The device on reset, will skip test mode and proceed to execute the user application.
For more information please refer: