It’s probably related to Engine/Source/Programs/UnrealBuildTool/UnrealBuildTool.csproj lines 2 and 15, which changed the ToolVersion and TargetFrameworkVersion.
Particularly interesting is that the same change was made before 4.21, and then reverted before release with the note
due to builders not having .NET 4.6.2
Anyway, check your Visual Studio Installer, and ensure you have the .NET Framework 4.6.2 SDK and targeting pack installed, and try the build again. Support for 4.6.2 is Optional in VS2019, not Recommended, so it won’t be installed if you just installed the .NET desktop development workload. It’s also optional in VS0217, so I expect more people will be hitting this issue.