I’ve been fighting with this for just over a month now, and I finally found the solution.
The problem was that my game bar recording options were greyed out, and the capture settings in windows were empty. Every solution I found online did not fix the problem.
The missing piece was a registry edit, provided by frbnfr on reddit: https://www.reddit.com/r/techsupport/comments/u1shbx/comment/jaykpoc/?utm_source=reddit&utm_medium=web2x&context=3
New-ItemProperty -Path "HKCU:\System\GameConfigStore" -Name "GameDVR_Enabled" -Value 1 -PropertyType DWORD -Force
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\GameDVR" -Name "AppCaptureEnabled" -Value 1 -PropertyType DWORD -Force
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows" -Name "GameDVR" -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\GameDVR" -Name "AllowGameDVR" -Value 1 -PropertyType DWORD -Force
The new part of this was the new entry in Policies\Microsoft\Windows\GameDVR