I figured out that it was a bug on TanStack Router where they used the route as the key on a top element. I advised them about it, and then they fixed it for me, and now it behaves as I wanted.