UE5: Trying to build project in VS nukes "UnrealHeaderTool" and then complains about it missing, corrupting the engine install

Same happens to me. It happened in both VS2022 and Rider.

Edit: This only happens when I select Build/Clean Solution or Build/Rebuild Solution. If I only select run, then rider will build ok.