I don't understand. What does bad RAM have to do with re-installing OS X?
Also, even if the RAM somehow corrupted the OS, weren't you able to boot into the recovery partition? Or even install it on a USB drive beforehand? https://www.apple.com/osx/recovery/
I always format the internal disk when I send in a computer for hardware repairs. I don’t expect to get the same computer back and I don’t want my data to be out there.