I found a solution on Reddit that actually worked for me:
From User: Visual_Ocelot_281
"To speed things up, you can use the following two registry files before and after switching ‘Remember that this is a game’ in the Game Bar. To enable DVR, copy this text into an editor and save the file with a name of your choice ending in ‘.reg’, then run it.
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\GameDVR]
“AppCaptureEnabled”=dword:00000001
[HKEY_CURRENT_USER\System\GameConfigStore]
“GameDVR_Enabled”=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PolicyManager\default\ApplicationManagement\AllowGameDVR]
“value”=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\GameDVR]
“AllowGameDVR”=dword:00000001
Restart your PC.
Open the game and toggle ‘Remember this is a game’ in the Game Bar overlay settings. Do the same as mentioned above with this text to disable DVR.
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\GameDVR]
“AppCaptureEnabled”=dword:00000000
[HKEY_CURRENT_USER\System\GameConfigStore]
“GameDVR_Enabled”=dword:00000000
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PolicyManager\default\ApplicationManagement\AllowGameDVR]
“value”=dword:00000000
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\GameDVR]
“AllowGameDVR”=dword:00000000
You may need to restart again to stop DVR from running, but your game should now be recognized in the Game Bar. Also, remember to check that your power plan is set to ‘Balanced’, even if you're sure it is—that could have saved me an hour the other day"