Try next
1.
Only for Installation:
<InstallExecuteSequence>
<Custom Action="SomeAction" After="InstallFinalize">NOT Installed AND NOT REMOVE</Custom>
</InstallExecuteSequence>
2.
For Uninstall try to use: Rob's answer
UPGRADINGPRODUCTCODE property is set only during RemoveExistingProducts
CA.