Dynamical management of potential threats regulated by dopamine and direct- and indirect-pathway neurons in the tail of the striatum