Externalize `any_instance` methods and state like we did mock proxies.

This is similar to #250, but doing a similar refactoring for `any_instance`.