As per my understanding, you want to run particular task only in preboot environment, but before running it you want to make sure, if you are into the preboot environment or not ? correct ?
There is a very simple way of achieving it with Notification Server
Let's say you have created a Job with two tasks in it.
1 Boot to PXE
2 Create Image
To make sure if create image is running in preboot only, you need to click on check box which says Fail job if any task fails ( you find this in new client job )
Now NS will take care of your concern.
Just for your information, with 7.5, Boot To PXE/Automation/Production will succeed only after booting into that particular environment unlike in previous releases. There is one more addition with this release, your server will not boot to PXE if it is already in PXE after running BOOT TO PXE task.
I hope this will help you.