Support for hasattr() checks (#13544)
Fixes #1424
Fixes https://github.com/mypyc/mypyc/issues/939
Not that I really like `hasattr()` but this issue comes up surprisingly often. Also it looks like we can offer a simple solution that will cover 95% of use cases using `extra_attrs` for instances. Essentially the logic is like this:
* In the if branch, keep types that already has a valid attribute as is, for other inject an attribute with `Any` type using fallbacks.
* In the else branch, remove types that already have a valid attribute, while keeping the rest.