Because Nokia R&D spend is 8 times that of HTC, and 5 times of Apple for that matter.[1] Nokia needs the flexibility with the OS. In an ideal world, Nokia most certainly should make an OS by themselves, but clearly that didn't happen, so they choose the one that gives them the most flexibility to do what they want, much more than just putting a custom UI on top.
And yes, the shock is risky. But the way things were going, very necessary.
[1]http://www.itpro.co.uk/630721/nokia-r-d-spend-outweighs-appl...