I rewrote the whole application in .NET 5. That did the trick.
Also, I found this thread that has a solution that evidently works for me as I’m trying again to get Open Id authentication to work in .NET Framework.
It uses the Owin.OpenIdConnectAuthenticationExtensions.UseOpenIdConnectAuthentication method rather than Okta.AspNet.OktaMiddlewareExtensions.UseOktaMvc. Is there perhaps a bug in the latter method?