Fold `MethodOrigin`s to resolve inference variables they may contain.

Fixes #17662.