I was able to solve the issue by adding an account in the Xcode settings under "accounts".
In the signing and capabilities menu, it looked like I was under my personal developer account (which looked correct) instead of my work account. It said My Name (Personal Team). Then when I added my personal developer account in the settings, it showed up as another item in the team dropdown but without "Personal Team".
It then worked because it was finally pulling the certs using the correct team id.