Is it possible to remove a bundled/downloaded JVM when uninstalling only if a certain condition is met ($VARIABLE$ = true, for example)?

I found the "Project -> JVM Settings -> Installer Settings -> Bundled / Downloaded Virtual machine -> Do not remove bundled / downloaded VM when uninstalling" setting, and this setting works exactly as I would expect and want most of the time.

However, I have a condition where I need to keep the JVM, even after the application has been uninstalled. This condition is signaled by a variable. Is there any way to check that variable and keep/remove the bundled JVM only if that variable is 'true'?

Could this be accomplished by adding an Uninstall step that just deletes the installed "jre" folder?

Any help is appreciated!