i'm not sure how tight your windows defender security rule was.Also, do you have this same problem in all of your projects, when you run in local or only this project alone create this issue? The below stack overflow discussion may helps you:
Has anyone else encountered this issue with Razor Runtime Compilation or other .NET Core 8 dependencies?
Personally, i didn't faced this type of error.
Is this something I should take more actions from, like reinstalling windows or some other measures? I already scanned the system with Windows Defender and downloaded Malwarebytes, both of which did not find anything.
I hope no other action needed from your end apart from "liberal" some antivirus rules in your windows defender. So try to disable the windows defender in your machine and try to run in local.
Hope this helps!