Repository: TypeScript
Issue: Interface definition utilizing `this` type errors out only in specific cases and only when a member is accessed, not before
Labels: Bug

# Bug Report

<!--
  Please fill in each section completely. Thank you!
-->

### 🔎 Search Terms

"interface this"
"interface this" intersection
"is referenced directly or indirectly"
"is referenced directly or indirectly in its own type annotation."
ts(2502)
HKT circular
intersection circular

### 🕗 Version & Regression Information

<!-- When did you start seeing this bug occur?

"Bugs" that have existed in TS for a long time are very likely to be FAQs; refer to
  https://github.com/Microsoft/TypeScript/wiki/FAQ#common-bugs-that-arent-bugs

If possible, please try testing the nightly version of TS to see if it's already been fixed.
For npm: `typescript@next`
This is also the 'Nightly' version in the playground: http://www.typescriptlang.org/play/?ts=Nightly

Note: The TypeScript Playground can be used to try older versions of TypeScript.

Please keep and fill in the line that best applies:
-->
- This changed between versions 3.8.3 and 3.9.7

### ⏯ Playground Link

<!--
  A link to a TypeScript Playground "Share" link which shows this behavior

  The TypeScript Workbench can be used for more complex setups, try
  https://www.typescriptlang.org/dev/bug-workbench/

  As a last resort, you can link to a repo, but these will be slower for us to investigate.
-->
[Playground link with relevant minimal code and commented version](https://www.typescriptlang.org/play?ts=4.2.3#code/PTAEFkEsDtIWwIYBsBQBvFouhgFwKYBOAZggMb6jED21APACoB8oaoCAXKAwNygBGXXAAtIAZwDaAIgRSAuqAC+PTNlwBPAA6U8RMfjK5I1aKAC8VWnTG5CMAOYsAZJfrQArnH5EmK7KA1tHGgAE3cKMQB9IkJqQnNggkJ9Q2NoaVk5FUUUFBBQAGFqODh8aAIQ9FUsXRJyShp6ZlZq-3YuXlb-YAAqHq7-HtAAd2Ey0AAKDnIIsQBKHDFQTVj+JHxEIzIAGiwB7CGEUMmOWpSjEwXxUBNKamIAsdAyWLF9EOeEfTFd0H2sIYAA34gNAMTiS2GkBEHH+oCGcKBAHJ+EjFqBCPhiEQyhQPiFIJjDEh1Dd4jACUTcCTEcEcLgltRhqZApQjtBqLgEBdoAA6BkTABMAFYAAyCuaA2m0gDyIiIUP0uw5YMIsUIvMRwH+gke4gy8j82ByrV6-TaQymZwMPLmXSGADlOfguGQxmQANagMAvahvUCIQgexnQEnsTSaMOQB63G7Ee2PSgrahrDbcyBkE4zfBvBZkL459iY0DuaBkYqlcr4SoW7X+VmJPQ2tLmf75Rp0I7qFhtXt9rD5QCg5G2wB2PF4fP2p96wMP++2rOPvIRnK46EvJ9gh-8OzY7NBHKAXGPPMuewOwIAZchHa67q5PE5Xffy1-no6spY9HOZ98Xp83M6gK+z7vvQn7ftAv5gdAX5MpBF6gHOIG3tA3ZHihaFTtu-gqKaYBTNmuatA2FLhDm0RqnErZvo2yTNiYNHEDA+D-NaqQmAaCgIcmqabBmN5sTy0j8PIW5gDx6x8WQrS4d0fQJgwTyAo0oIhFiMDQi21xMdAlClkYSDsGQswOOwAYbMuAbhMIoBINyRCaha3BPOC8T6BsATUKAwgIBG4xSO4mh7vgCBwFIVCxHAibPD5B74AA-ApTxqTpmkMa5pnUO4uAjGMLJPO4YgIPYlBukcJVLNcwz4ISITbAm7lwEsSCQB6bICO49iJbWKCKEAA)

### 💻 Code
With version 4.2.3
<!-- Please post the relevant code sample here as well-->
```ts
interface foo<T> { a: T; b: this["a"] };
//                       ^- 'b' is referenced directly or indirectly in its own type annotation.ts(2502)
type intersection = foo<string> & foo<number>; // Works in some cases, shown in linked playground
type induces_error = intersection["a"]; // Comment this out and the error in the interface goes away
```

Found when messing with ways to simulate HKTs with `this` type, which itself seems to be considered a valid use case, per:
https://github.com/microsoft/TypeScript/issues/40928 https://github.com/microsoft/TypeScript/pull/40967

### 🙁 Actual behavior

<!-- What happened, and why it was wrong -->
- Interface definition erroring out for an unclear reason when using said interface later down the line, but not before. It doesn't seem right that the definition shows an error that wasn't there before by just accessing a property.
- Error itself is questionable, worked in 3.8.3, and a similar use case seems to be covered by the test (#40967) linked above?

### 🙂 Expected behavior

<!-- What you expected to happen instead, and why -->
- Interface definition either always errors, or an error doesn't pop up only when using the interface definition only in specific ways.
- Additionally, reason for circularity error is not immediately obvious to me, and it seems it might a regression since 3.8.3?