The peloton is also a social entity. It is possible to save energy within the main group, but someone is still breaking the wind at the front. Those workers are allowed their moment in the sun in a breakaway.
Within the peloton are actors whose understanding of the dynamics is more sophisticated than the computer models. They work out how long the break deserves in the limelight, and when to put the hammer down to force a sprint finish. Their role is diminished by rider radios, but they could still do the same job with information from the motorcycle boards, with less certainty, so wins from breaks were more common in the past.
My favourite ever stage was when Eros Poli staged a break which saw him win over Mont Ventoux. Another rider had tried to stage a break on a hot day, and Poli rode up to police him. Poli was popular enough for no-one to follow, and big enough for a victory to look unlikely.
The Grand Tour Peloton is a symbiosis between workers, sprinters and climbers. Breaks are a reward for the workers, and sometimes they succeed. The cobbled stage was also a gift for the workers, the fact that they emerge looking like they've been down the pit is symbolic of that.