Yes if you allow customers to upload executable code then you have no security - except through obscurity.
You could have an interface whereby you have a USB MSC (removable storage device) profile and people can drop files into that. Then your code can validate those files in some way. My product does exactly that. It also has an HTTP server which presents a view of the filesystem and that is another way but USB is a lot less work (FatFS and the ST USB MSC code). Other ways would be a PC app which interacts with your box over a serial port and uploads the modules but that is more work and you have to maintain a windows application on top! And laptops don't have serial ports anymore, etc, etc.
Even if you have set RDP2, your code can still program the CPU FLASH. This is how you can do secure firmware upgrades. The upgrade is encrypted and/or has a hash on the end, and the decryption key is stored in the CPU FLASH which in theory cannot be read under RDP2.
The problem is that, as the above cracking examples show, probably not a single industrial-level uC is secure from the VCC pulsing attack. And every box you sell will contain the key, the attacker needs to just get hold of one, and then the entire installed base is vulnerable. Just like DVDs all became wide open once the mpeg keys were extracted from a copy of PowerDVD...
However, depends on who the customers are. If they are big firms they are very unlikely to do hacking, in case somebody on the inside spills the beans on them. Big firms today also almost never touch bootleg software. But smaller users may well have a go. That is my experience across 40+ years. I used to sell to banks, utilities, etc and they would not touch it, but small businesses, especially ones run by people from, shall we say, the Indian subcontinent, frequently had a go at disassembly, sometimes complaining to me that I made it hard

Today, the chinese will attack anything that is worth attacking, and copy it.
Yes timers have been used since the 1970s to break single-stepping but the ST chips have an option to pause timers when single stepping.
All the modern uCs have a unique CPU ID and it would be normal to duplicate that in another EEPROM type device on the board. Disassembly will find it but you can bury it deep.
There is an endless list of obscurity methods. In the 1970s and 80s, Z80 days, people used to execute the copyright message. ASCII letters were mostly reg-reg moves and you could rig it that if the copyright message was edited out, it would crash, etc. But asm was also very easy to unravel. C is much harder.
If you have a very high value algorithm then you can run it on a modern smartcard chip, which is supposedly immune to these attacks. They have a serial port and you can interface it to a uC easily. I did such a design many years ago. The smartcard chip contained fast RSA hardware, secure key storage, and it had an 8051 for housekeeping. I don't know the state of the art now.
People also use Xilinx RAM-based FPGAs for protecting designs.