Answer:
A toilet requires a large amount of cold water to flush. So, when the toilet flushes while you're in the shower, it's stealing from your shower's cold water supply. When the pressure-balancing valve senses the drop in cold water pressure, it responds by restricting the hot water pressure.