I would suggest checking out ToQueryString to compare the differences between queries in .NET 6 and .NET 8. Then compare the query execution plans by using something like SQL Management Studio (Depending on the database).
Check answer: https://stackoverflow.com/a/77750594/6866338 for more information, on how to set the CompatibilityLevel
to change the way that EF Core generates it's queries.
Also maybe an interesting Github issue that might help: https://github.com/dotnet/efcore/issues/32394