In Star Trek Enterprise (Regeneration) the Borg assimilate some people, cause havoc and run amok. During all this Phlox gets infected with some nanites and begins to be assimilated. However, he ingeniously develops a method of deactivating all the of nanites in his body, essentially curing himself and preventing his impending oneness with the collective.
In universe, why wouldn't this knowledge still be available and even improved upon, perhaps being turned into some kind of a weapon, by the 24th century? Starfleet knew the Borg were a threat and were out there. They knew they would run into them eventually, and that they were woefully unprepared.