staticdata: fix serialization ordering for cyclic datatype supertypes (#62050)
Change the deferred enqueue for `super` types to utilize a worklist
`deferred_supers` that `jl_serialize_reachable` drains only once the
pre-order recursion has fully unwound. This allows us to properly defer
exploration of the supertype and all of its type parameters. This
extends the previous fix in JuliaLang/julia#52752, which did not handle
the case that recursion occurs through supertype parameters.
These kinds of "special case" / "defer sometimes" behaviors are a great
place for bugs to hide anyway, so it is better to have one uniform
behavior to handle `super` in the serializer IMO. Case in point: Also
fix (1) a bug with `must_be_new_dt` not accounting for `super` deferral
and (2) a corner case where items with identical supertypes would be
deserialized incorrectly due to how we iterate `uniquing_super`, spotted
by inspection by Claude Fable 5 and a more serious problem now that this
makes deferrals more common.
Fixes #62047
Bug analyzed and fix implemented by Claude Fable 5
<noreply@anthropic.com> 🤖 🪄
I did check its work / revise the changes and I believe its analysis /
fix is correct.
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>