Research facilities & universities wouldn't have warp cores for weapons or travel. They would have full or partial real warp cores for scientific & technological research. And they would have dilithium on site, to power their experimental reactors, for research & improvement, or whatever. And it was ultimately the dilithium that exploded.
Like if today suddenly all gasoline would explode - you would not only lose everyone driving a car right now. You would also lose all workshops, all car manufacturing sites, the whole oil drilling industry, every garage tinkerer and every vehicle construction engineer and professor at the same time. Building the next, first functional car after that would take decades.