Follow-on from https://github.com/TanStack/query/discussions/8495

This PR extends the use of the `Register` interface so that it can narrow the type of `QueryKey` and `MutationKey`, for situations where users of the library want to enforce a hierarchy of keys at the lowest-level possible.