* Make tree_util.tree_flatten_with_path and tree_map_with_path APIs to be C++-based, to speed up the pytree flattening.
* Moves all the key classes down to C++ level, while keeping the APIs unchanged.
* Known small caveats: they are no longer Python dataclasses, and pattern matching might make pytype unhappy.
* Registered defaultdict and ordereddict via the keypath API now.
PiperOrigin-RevId: 701613257
Notable changes:
* use PEP 585 type names
* use PEP 604 type union syntax where `from __future__ import annotations` is present.
* use f-strings in more places.
* remove redundant arguments to open().