If you look at the exploded diagram of a Nespresso machine ( google it, they all seem to be basically the same ), then you'll see there is a flow meter.
The quantity of coffee dispensed is measured through this; it's not based on a timer.
These can and do fail, and are easily replaceable.
I've not ripped one apart, but I expect it's a simple impeller design, and the impeller becomes sticky and stops rotating freely.
I have a Sage espresso machine here (not Nespresso) whose flowmeter has failed.
It began to intermittently dispense irregular quantities by failing to stop at the required volume.
It now does not stop by itself at all. ( Actually, it eventually does. I think there's a backstop timer to guard against flowmeter failure. )
I've not replaced the flowmeter because I actually prefer being able to manually stop it when I like.