Phase transitions as a manifestation of spontaneous unitarity violation