When I flag some question, answer or comment, I would expect the flag button to turn into some "undo" button
Well, it sort of does; if the flag hasn't been processed yet, you'll be able to 'Retract' the flag. (This only works for post flags.)
For comments you have flagged, the flag link isn't clickable anymore in that case, just like you indicate to expect.
But, when a flag has been processed (declined, marked helpful, disputed) or retracted or aged away you can cast another flag on the same post or comment; just not one of the same 'severity' (except for when it has aged away).
Example: after your spam flag has been declined, you can still cast a Very Low Quality or Not An Answer flag. If you retract that flag yourself, you can still cast a custom moderator flag. Generally speaking, you can have at most one active flag on a single post or comment at a time.