[ty] Lazily evaluate declaration reachability in field and enum filters (#24451)
## Summary
Small optimization: only determinate reachability for "bad"
declarations, so that we do the cheap check (is it "bad"?) before the
expensive check ("is it reachable?").
CodSpeed shows a 2% improvement on Pydantic and 1% on some other
projects like Pandas and SymPy.