[turbopack] Support undoable modifications for many field types on TaskStorage (#95180)
## What
Allow some modifications that turn out to be no-ops to be undone on
TaskStorage. This saves us some redundant check-then-mutate cycles.
This doesn't apply to every field type
* `Option<T>` - still read-check-modify
* `CounterMap<T>` - updates are unconditional tracks and removals use
the undo approach
* `AutoSet`/`AutoMap` - mostly uses the new 'undo' approach
* `take` as a bulk operation does not, taking an empty set is rare and
cheap to check for
* `AutoMap::insert` doesn't use the undo approach or even check, we
always track a modification since all callers are only inserting unique
values anyway
A few other incidental cleanups were landed as well.
## Why
Avoid redundant hash lookups.
## How
Have `track_modification` return a new TrackOutcome that records what
modifications were made and then in the undo case we can pass it to a
new `undo_track_modification` function which can reverse it. This is a
little brittle since both operations need to occur within a single lock
transition
I considered using a 'lambda' oriented approach but decided against it
since it would be awkward for some of the mutators and as all the
callers are generated by a macro (well _almost_ all callers) it isn't
too risky.