On the origin of phosphorus nitride in star-forming regions