It didn't have to be. The same toxic dynamics that compromised their software poisoned their hardware, but they had too many products, or eras of a product, that Just Worked(TM) for it to have been a fluke. Someone knew what they were doing. They were screwed over by competing interests.
Zune people loved their Zunes. Windows Phone 8 people loved their Nokias. I've seen Surface Pro 2s "boot" to the same session for half a decade (that is: put it to sleep, stick it in a drawer for a year, take it out, plug it in, turn it on, all of the same files and folders and apps are open; I've NEVER seen this happen with any other device, they always lose state after enough time unplugged). And it's crazy how badly the Courier/Surface Duo was botched, given the excitement for it. Even newer Surfaces are great for the first year, before all of the compromises and poor engineering decisions make themselves known.
Imagine if it had been managed by someone who actually cared about their users, instead of people who treated them like marks and rubes.