Transiently changing shape of the photon number distribution in a quantum-dot–cavity system driven by chirped laser pulses