There are two issues:
The post-code-deploy Cloud Hook is deprecated and unsupported so it should not be executed on ACSF environments #2227 made this change in BLT 9.x and it was not backported to BLT 8.x. You should instead us the db-update Factory Hook such as the one in BLT 9 which will run
blt deploy:updatetasks on each site during a code deploy. Additional documentation and examples of using BLT with the db-update Factory Hook is available in the Acquia ACSF documentation as well: https://docs.acquia.com/index.php/site-factory/extend/hooks/dbupdate#blt.
Update environments are explicitly excluded from all Cloud Hook execution because in ACSF deployment / platform code updates, this is actually your "live" environment. The BLT Cloud Hooks scripts already have this exclusion for the standard environments: https://github.com/acquia/blt/blob/8.9.14/scripts/cloud-hooks/functions.sh#L14
BLT provides post-code-update hooks (as opposed to post-code-deploy) for default ACSF environments 01dev, 01test but not custom environments like
02dev. In your case the hook actually executed in your
02devup environment which is your update environment and since the deploy was a branch as opposed to a tag, the post-code-update executed against the
02devup environment a second time using the Acquia Cloud scripts rather than the
acsf_deploy script in functions.sh. You can add environments to this list and modify your post-code-update.sh script to execute your custom fucntions.sh script. Before making these changes you should review the ACSF Hooks documentation, particularly the section "Using Acquia Cloud hooks" and the hooks which are not supported on ACSF.