The amount of code memtest takes up is tiny compared to the actual memory being tested. See:
https://en.wikipedia.org/wiki/Memtest86
"MemTest86 is designed to run as a stand-alone, self-contained program from a bootable floppy disk, CD-ROM, USB flash drive, or from a suitable boot manager without an operating system present.[9] This is because the program must directly control the hardware being tested and leave as much of the RAM space as possible for examination. "
I don't have solid proof, but considering the megs of L2 Cache CPUs have nowdays, I suspect memtest86 runtime probably fits in a tiny fraction of that CPU cache.
In any case if memtest blowsup/crash even before it gets going, because memory where it was loaded on to was bad, it would be pretty obvious something is wrong. You won't be able to say for certain it is the memory, but you would definitely suspect it.