On the origin of hot diamagnetic cavities near the Earth's bow shock