I am aware of Secure boot. But this problem is a separate issue.
While my knowledge of what was done earlier is hazy, it was specific at that time to Windows XP and BartPE builds.
I recently ran into the same scenario on a computer of mine that I was attempting to upgrade from Win7x64 to Win10x64. This upgrade failed. The bios is set to standard old Bios no fancy stuff, no Secure Boot, no UEFI. None of those settings are even available in the machine.
I had previously tested my Win7pe on the machine in question and the Win7PE booted and ran well. In fact I created my backup disk image from that same Win7PE boot disk.
When the Win10 upgrade failed, I found I could not complete the Win7PE boot. It would get part way and suddenly the machine swapped to booting from the hard drive and would try to finish the failed upgrade. Which would of course, fail every time.
What I ended up doing was removing the hard drive from the machine and insert it into a USB external dock connected to a separate computer. From that other computer's Windows 7, I formatted the main partition of that drive. I then refitted the drive into the first machine and then my Win7PE was able to boot from it again.
From that Win7PE running, I was able to delete all partitions on the drive and test it. When I was sure it was ok, I rebooted and then used the tools on the Win7PE disk to restore an image of the original drive.
When it finished I booted the from restored drive and removed all antivirus programs plus quite a few no longer required programs and I eventually was able to upgrade to Windows 10 successfully.
I admit the last time I had this symptom/problem was a long time ago. I also don't know if it is even possible to include a modified file in a more modern OS derived PE disk.
I am not even sure what to even do a Google search for.
All I can say for a fact that years ago I had the exact same symptom and I found at that time that one file could be hex edited. I edited that one file so that the one or two (files or) folders WinXP looked for was no longer valid. Since the XP CD was copied to the hard drive I substituted the modified file into that location on the hard drive.
Any build of BartPE from that hard drive source would thereby automatically include the modified file.
Because the files/folders the BartPE XP checked for were now not recognised, I was able to boot a BartPE on a failed Windows XP install system.
I hope that is a bit clearer. My problem is because I did it once, I forgot entirely about it until now. Somewhere on my hard drives I may have it written down but it would be a hell of a search to find it (assuming I can).
Regards,
BobxT