Why doesn't a mercury thermometer follow the rules of volume dilatation?

I think you are speaking of a clinical thermometer which records the maximum temperature it reaches. The thermometer has a narrow kink in the bore near the bulb that causes the mercury thread to break at that point when the volume of mercury in the bulb shrinks (the image you've posted actually shows that). As a consequence the top of the thread does not retract from the high-point reading. (One might worry about the mercury above that break-point shrinking, but there is very little mercury in the thread, most of it is in the bulb. Consequently there is little effect from the volume of the thin thread getting smaller.)

The reason that the thermometer is designed this way is so that the doctor or nurse can take their time in reading the thermometer --- which would otherwise begin to read lower temperatures as soon at it is removed from the patients mouth, or wherever.

Shaking the thermometer after it has coooled to room temperature causes the mercury in the broken thread to reconnect with the mercury in the bulb, and allow it to be used again.

That's because it's a maximum thermometer, which works by pushing the liquid past a restriction in the tube, preventing the liquid from returning into the reservoir upon cooling. If you look closely, you might see the separation in the liquid column between the restriction and the reservoir, which may be bigger or smaller depending on the model.

You don't cool the thermometer down by shaking it - you push the liquid back to the reservoir with an additional force coming from accelerated motion.

As a side note, thermometers which have a secondary reservoir (such as in your picture) are often calibrated to provide accurate reading at room temperature. Reading them while they are still hot gives you a falsely high value.