For future reference : I asked the same question on reddit and a nice gentleman gave me the following answer. The post is here
Pooled contexts are registered as singletons basically, which means they can't resolve scoped services.
WebApplication just enables dev only checks that throw exceptions in this case, looks like Host variant doesn't.
Changing from .AddDbContextPool()
to AddDbContext()
fixed the issue. Thank you, kind gentleman.