I don't know about the Windows 10/11 UWP stuff, but in any good version of Windows you can hit control+c on any standard dialog to copy the error text and the text of all buttons to your clipboard.
It's a little annoying that you can't easily make subselections in dialogs, but that's been a core Windows UI design element going back to Windows 1.0.
It's a grossly underadvertised feature of Windows and I bet the people reimplementing the Windows UI for the third time in ten years don't know about it either.