Fix crash with overload and callable object decorators (#11630)
Fixes #8356, as identified by @pranavrajpal
Fixes #9112
Fixes #9967
Note that we still don't fully support the singledispatch pattern in #8356,
since we get 'overloaded function has no attribute "register"', but that's
much easier to work around than a crash.
Co-authored-by: hauntsaninja <>