Interaction and spontaneous formation of defects in the vicinity of the phase transition point in crystals