The immediate problems were software, but the hardware was what doomed it and I don’t see how they didn’t see that from the start. It could never be in all their products (e.g. iMac, well, without requiring a wired keyboard but that was never going to happen) so it could never be more than an accessory.
I think they realized that too late. It’s a shame though. In a MacBook-only world, I wonder what would have become of it.