‘Dogs’ breakfast’ legislation ‘flies in the face of long-held civil liberties’, say teaching union leaders