Dynamic generation of spin-squeezed states in bosonic Josephson junctions