[ty] Clarify go-to-implementation search prefilters (#29380)
## Summary
Previously, the textual pre-filters for go-to-implementation were
unclear in two respects:
- The two pre-filters, one for the member name and another for the
`class` keyword, were implemented in two different places in the source
code
- The `name_matcher` field checked for each file could hold either a
matcher for the `class` keyword or a matcher for the member name, which
made its behaviour hard to understand at its usage site.
This clarifies the pre-filters by keeping both checks together and by
making the `name_matcher` field consistently search for the member name
(with the `class` keyword search implemented separately). It also
prepares go-to-implementation for #29232, which releases scanned closed
files' ASTs to reduce pauses during database updates.
/xref https://github.com/astral-sh/ty/issues/3909
## Test Plan
This is a behaviour-preserving refactor that relies on existing tests.