A few years ago, I asked the PM of the Visual Studio Debugger the same question in the comments in of one of his blog posts. I searched my email archive and found a mail from February 04, 2006:
My question was:
... I also would like to know how the Visualizers provided by VS2005
manage to display the expression (topmost textbox in the Visualizer
form).
And the answer:
... The reason the string visualizers can display the original
expression is that they are built into Visual Studio at a lower level
than the Visualizers interface we provide. They are written in native
code and work when debugging native code, while the visualizers
architecture we provide is limited to managed code.
Sorry!
Let me know if you have any more questions.
Scott Nonnenberg
Program Manager Visual C# Team
This was on http://blogs.msdn.com/scottno/default.aspx but I think Scott is no longer a Microsoft employee and the posting won't be available online...
It is quite probable that this has not changed - even in VS2019 where the mechanism was modified to work with .Net Core.