Quantum equivalence, the second law and emergent gravity