The only feasible way I can think of is to turn your .NET Framework 4.6.1 class library project as a multi-targeting one, like I wrote in "Tips on Target Platform Selection". and in your case, simply target both net7.0 and net461 as those are required by your projects.
.NET Standard 2.0 is no longer a suitable target to choose as it is too limited (.NET 5/6/7 expanded the API surface significantly).
The benefits of switching to multi-targeting is that the C# compiler immediately informs you of incompatible code at compile time, so you can use conditional compilation to exclude certain pieces (such as usage of EF 6) from net7.0. That's much better than blindly loading the assembly by .NET 7 and receiving miserable runtime exceptions.