turbo-tasks: copy tasks on their first modification during a snapshot (#99649)
### What?
During a snapshot, a task's first modification now copies the task's
pre-mutation state whenever any of its categories is part of the
snapshot, whichever category the modification touches. A `None` marker
is inserted only for tasks with no modified category.
### Why?
`track_modification` used to decide based on the touched category only.
That let a snapshot persist inconsistent state. Take a task with dirty
meta and clean data:
1. The snapshot begins.
2. Data is modified. Data wasn't part of the snapshot, so only a `None`
marker is inserted.
3. Meta is modified. A marker is already present, so nothing is copied.
4. Persistence encodes the live meta, already mutated by step 3.
### How?
The design is otherwise unchanged: `*_modified_during_snapshot` bits,
`None` markers and the promotion in `end_snapshot` all stay, and nothing
new happens inside the operation exclusion. Only the first-modification
check in `track_modification_internal` changes, from "is the touched
category modified" to "is any category modified". The copy still encodes
with the live modified bits, so categories that weren't part of the
snapshot aren't persisted.
A regression test covers the sequence above. It checks that the
persisted item carries the pre-snapshot meta and no data, and that both
modifications are left for the next snapshot.
<!-- NEXT_JS_LLM -->
<!-- fleet 98a896e8-00fa-4f81-97f0-48bd49e2a9a2 -->
Co-authored-by: vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com>
Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>
Co-authored-by: Luke Sandberg <210140+lukesandberg@users.noreply.github.com>