CleanMyMac (and similar softwares) are pretty nasty. However, there's a few things you can do.
First, remove it from your Mac as per MacPaw's instructions. Make sure to use the uninstaller they provide. Instructions can be found here.
Next, data. Some data may be lost forever, but if you have a recent backup, you're fine. If not, you might lose some items. You mentioned you couldn't back up with Time Machine- what happens when you try? You might need to manually select it from the Time Machine dialog. Go to System Preferences > Time Machine > Select Disk and choose it from the list (while it's attached).
Your disk will have to be erased and reformatted. A backup is necessary here. One from before the use of the software is the best, but if not possible, you'll have to use a new one.
Boot back into macOS Recovery (CMD + R on startup) and choose "Disk Utility" from the list of options. Select Macintosh HD in the sidebar of Disk Utility. Click the Erase button in the toolbar, then enter the requested details-
Name: Macintosh HD
Format: APFS or Mac OS Extended (Journaled), as recommended by Disk Utility
Click Erase. This will remove all content from your Mac. This cannot be undone! Ensure you have a good backup handy. However, if you see an Erase Volume Group button, click that button instead. If asked, enter your Apple ID. After the erase is done, select any other internal volumes in the sidebar, then click the delete volume (–) button in the toolbar to delete that volume. During this step, disregard any internal volume named Macintosh HD or Macintosh HD - Data, as well as any volumes in the External and Disk Images sections of the sidebar. Quit Disk Utility to return to the utilities window.
Now, you can reinstall macOS. Boot into macOS Recovery (Shut down your computer, then hold CMD + R on startup) and follow the instructions to reinstall macOS. This should not remove any data from your computer - How to reinstall macOS - Apple Support
After doing so, boot into macOS. Open Migration Assistant and choose "From a Mac, Time Machine backup, or Startup disk". Make sure the Time Machine backup disk is connected to the computer. Press continue and choose your backup based on the options below-
If you have a backup from before the usage of CleanMyMac-
Simply select that backup and proceed normally. You can select everything.
If you do not have a backup from before the usage of CleanMyMac-
Only select your user account. Do not select Applications, Other Files and Folders, or System & Network. You'll lose data, but it's necessary to remove CleanMyMac.
From there, follow the prompts and wait for the transfer to complete. Hopefully you didn't lose too much data, but at least your Mac is safe and secure again.