You can write a little utility that looks at the last time the ObfuscatorMap.txt file was modified. The B4J File Object and the jFileWatcher library allow you to check that info. This utility would run in step 2.
Alternatively, you can write a little utility that is activated in step 1 of the custom build action and runs for (say) 20 seconds. If it observes (using the jFileWatcher library) a modification in the ObfuscatorMap.txt file, it can take some action (like creating an indicator file that some utility running during step 2 will read).
At the moment I read the main.java file in the src/b4j/example/main.java and see if there is anything named "_vvv*" in it. If yes, then it means it has been obfuscated.
You can create two build configurations. One with obfuscation and one without it and manually change the deployment type (release or release with obfuscation).
Might be simpler to use the command line builder with a batch file.