The 'immediate'
custom actions are not executed by the elevated part of the install. Thus they are only elevated in the installation process is run elevated (as you've seen). To have the custom action be elevated they must part of the transaction script. To do that set the CustomAction
element Execute='deferred'
attribute.
Note: Deferred custom actions have other limitations that are documented in the MSI SDK: 'Deferred Execution Custom Actions' topic. Since it looks like the custom actions are modifying machine state, you'll also want to look into adding rollback custom actions to undo the changes that are done by the deferred custom actions.
Writing custom actions well is quite challenging. That is part of the reason why custom actions are the largest contributor to installation failures. If you can avoid writing custom actions, I highly recommend doing so. :)