As discussed on p. 100-101 of Before Dishonor, the circumstances that led the cube to adapt in this way were unprecedented, but the adaptation was a choice, not an accident. The technology of a Borg cube is sentient -- arguably more sentient than the drones, whose individual mental activity is suppressed. Starfleet's biases led them to assume that the deactivation of the Queen and the drones meant that the technology was inert, but that's not true. The Borg were as much technological as biological, and you don't defeat the Borg unless you defeat both halves. A thalaron weapon would neutralize the biological half of the Borg but leave the technology untouched, and that's not enough to make for a victory.
And what was the unique, unprecedented circumstance that made the supercube in BD choose to adapt in this way? In the Janeway Queen's own words, it was humiliated by its continued defeat at human hands. Probably a melodramatic way of describing their state of mind, but perhaps a more objective term is desperation. The mindset that drove the main Borg Collective to launch its full-scale assault on the Federation was similar: they'd gone beyond seeing the Federation as an annoyance and had recognized it as a serious threat. If the Federation had been able to use a weapon that neutralized all the Borg drones on over 4000 cubes, then it's not unreasonable to think that the surviving technological sentience of those cubes would experience the same sense of desperation, humiliation, whatever, and would make the same choice. After all, the incentive would be much the same.
If the borg had the capability to create grey goo that can eat planets in minuts, they would have used that capability before "before dishonor". They never used it - they don't know how to make it.
You say that, in order for the borg to adapt this grey goo, they need to be desperate, humiliated. This happened many times to the borg before.
Species 8472 destroyed far more than 4000 cubes - almost destroyed the entire collective - and the bord didn't create their grey goo, despite their desperation.
"Destiny"'s own "children of the storm" destroyed hundreds of thousands of borg cubes - and the borg did't gain the superpowered ability from "before dishonor".
And there were undoubtedly many other off-screen instances when the borg lost badly - and they never adapted their grey goo.
You may say that another requirement for this adaptation is the death of all drones on a cube and the survival of the cube.
Considering the borg's redundant tech and the many conflicts they fought (some of which they lost), it's extremely improbable that such a situation never occured before (in a losing battle). And yet, the borg never developed the unstoppable grey goo.
What happened in "before dishonor" was practically impossible, it was a freak accident. It was like Enterprise D gaining sentience out of the blue and creating a space baby - something never before seen, that will never be seen again.
Either that, or, in the entire borg history, there was never a situation that fulfilled the simple requirements necessary for the creation of "before dishonor"'s grey goo - which is ridiculously improbable.