You can do it by dynamically creating a new type that inherits from DbContext and the use Reflection Emit to add the DbSets to this type.
It's a bit of a long solution to try and post into a response here, but here's a GitHub link to a working demo of how it can be done
EF Core Dynamic Db Context
db.Set<T>(). But you do need the type defined in the model somehow.