I have found your solution I think!
According to VMware vCloud Director 5.5 Documentation Center
You can upload a customization script to the vm. The script runs before and after guest customization when you deploy a VM based on a vApp template. I believe this will do what you are looking for.