Sure that is possible. Many automation apps (see our automation tag-wiki) offer that. I e.g. use tasker (see: tasker tag-wiki) which offers to perform actions on device boot, and can execute shell commands. So a typical Tasker profile could be fired "on device boot" to "execute shell command" rm -rf /storage/sdcard0/DCIM/thumbnails
. No check needed for the existence of that directory: If it existes, that command would remove it – and if it not exists, result is the same :)
While Tasker is not free (there's a 7 day trial, though) there are other free automation apps you could check with. I don't have a list of which ones provide on-boot command execution, so you had to look that up yourself.
In case your device is rooted, you'd have additional possibilities – e.g. utilizing init scripts. If your device doesn't support them as-shipped, there are some apps which could help adding that feature.
Disclosure: the linked app lists are my product, so those links go to my website.