Thermodynamic energetics underlying genomic instability and whole-genome doubling in cancer