This is all correct, small technicality is that a Z-pack only works on gram positive bacteria but that’s getting a little too in depthTruth: Z-packs do not work on viral infections such as a cold.
Because: Z-packs only work on bacterial infections but, oftentimes, bacterial infections accompany or follow viral infections due to the weakened immune system.
Therefore: Some doctors prescribe Z-packs if they suspect two infections, a nascent or potential bacterial infection with the viral infection. When this happens, it looks like the Z-pack cleared up the cold but it actually cleared (or prevented) up a second infection.