That is why, despite (or because of) years of cycling experience, you should always safety check your bike before riding.
The free cycle training that the local council offered used the "ABCD" mnemonic:-
Air (check the tyres)
Brakes (Try both brakes before starting)
Chain (check the chain is sufficiently lubricated)
Dangly bits (check that luggage/jackets/etc are secured and nothing can fall into the wheel)
All of that can be checked in under 30 seconds before setting off each time and it doesn't take too many times doing it before it becomes habit.