Replace multi_weakref_lru_cache with a C++ implementation.
We do this by refactoring WeakrefLRUCache into a base class WeakrefLRUCacheBase that contains almost all of the logic of the cache, and two subclasses WeakrefLRUCache and MultiWeakrefLRUCache that are identical up to how they form cache keys during __call__(). WeakrefLRUCache retains the current behavior of treating the first N positional arguments as weak. MultiWeakrefLRUCache instead uses a pytree to pull apart each argument into a tree def and leaves, and then treats a user-provided set of types as weak.
PiperOrigin-RevId: 879039781