I've seen this when targeting .NET 5 and not with lower .NET Frameworks. A telltale sign that the IDE is incorrect is as with you I can replicate this and still run and actually go to the definition of any line as per below.
Example
Here is where the other images comes from, select menu item project then show all files.
Then here is a incorrect assessment by Visual Studio
Note
I've not reported this as I have a experimental setup within Visual Studio. If this truly bothers you then report it to Microsoft via the feedback/report an issue button.