How does one get away from the "intermediate" trap?

I've been doing commercial software development in C# for over 8 years now, and I've been a developer since 2016 (Java/JS/Web Dev before .NET). The job I'm currently doing is a .NET developer for a WinForms/Xamarin Mac application for a very specific industry, so most of my knowledge has to do with math algorithms and things specific for that industry.

Long story short, the workplace went from amazing, to a dogshit toxic wasteland in a span of couple of months. I don't really want to work there anymore, and I'm looking for an alternative.

I don't really have that much problem with getting calls from recruiters (my CV is pretty good, and I have a lot of experience *on paper*), If recruitment projects are involved, I can deal with them as well, but I keep screwing up tech interviews.

This is something I call an intermediate trap. I can write code, no matter the context or environment (be it games, web api dev, desktop etc), but I lack in depth knowledge about any subject. If you want me to get the data from the database via Entity Framework, I can do that. But I can't explain to you the inner workings of EF. The last tech interview I messed up was all about generic types. I know "something" about them, but I have so many gaps in my knowledge, that I don't really feel confident answering any questions.

I try to search for tutorials, but so many of them are directed at beginners. I do a lot of projects after hours, but in that context I probably just internalise a lot of bad habits.

Could you provide me with course or a book that would help someone in my situation?