After enabling more debugging by adding:
"Microsoft.AspNetCore.SignalR": "Debug",
"Microsoft.AspNetCore.Http.Connections": "Debug"
To the appsettings.json I discovered the message:
System.InvalidOperationException: Reflection-based serialization has been disabled for this application. Either use the source generator APIs or explicitly configure the 'JsonSerializerOptions.TypeInfoResolver' property.
Which turns out to be related to: https://learn.microsoft.com/en-us/dotnet/core/compatibility/serialization/8.0/publishtrimmed
So after setting PublishTrimmed to false in the project configuration it is now working as intended. I will most likely go over to using the source generator api later, but at least I now know what the root of the issue was.