Fix incremental crash on TypedDict in method (#16364)
Fixes https://github.com/python/mypy/issues/16336
All the story with `@`-names is a mess. FWIW I just copied the logic
from named tuples, where it works. So although it is a mess, it will be
now be a consistent mess, with full parity between `NamedTuple` and
`TypedDict`.