The differentiation between UI on Android phones is a pretty strong indication that competing on hardware isn't enough - vendors need to compete on the software as well. Nokia would have been starting years behind their competitors, and there was no reason for Google to give them any help. Microsoft needed a top-tier phone manufacturer who would gladly dedicate themselves to their platform (so, not HTC) and could provide the engineering effort to make up for Nokia's lack of experience. If they'd gone Android they'd just have been an expensive but otherwise generic Android device, perhaps with a better camera.
Sure, over time Nokia could have pushed Android down into their lower end devices and differentiated themselves there, but the Chinese vendors are already busily doing that and again Nokia would have arrived years after everyone else. They didn't have years. Distasteful as it may be, going Windows was a rational choice for Nokia.