Refactor and pass correct interpreter to typeinf finish loop (#50469)
When we have an inference loop with different interpreters,
the current code was trying to cache everything with the top
level interpreter of the loop, yielding some unexpected behavior.
I don't think that it's necessarily super well defined what should
happen here, as it depends on the interpreters, in question, but
I think it's better to try to cache each frame with the interpreter
that created it, since they may have different lattices, etc.
Doing this fixes an error I saw downstream that had just such
a situation.
---------
Co-authored-by: Shuhei Kadowaki <40514306+aviatesk@users.noreply.github.com>