Dynamite is stable (unless old as Otherbrother pointed out) and requires the shockwave from an exploding blast cap to detonate, otherwise it just burns energetically, which is how they disposed of it.
Storing the less stable blast caps (electrical rather than a classic fuse) with the dynamite sounds like extremely bad practice.