The Torah does not go in for co-incidences. Whatever happens, whatever is recorded in the sacred text, is there by Divine design.
In this case the explanation may be that Pinchas’ act of summary justice was approved by God so that Pinchas was granted “the covenant of peace for ever”. It sounds like a paradox – an act that disturbed the peace succeeded in establishing peace.
As far as later generations are concerned, the Torah may be saying that the way to eternal peace is not through impulsive acts of fanaticism but by quiet training of the character in the ethical principles of the Sabbath and festivals – freedom, moral law, faith in Divine protection, respect for the creation.
Our way to peace must be to live at peace with and enhance the well-being of God’s world of time and space and His creatures, human and animal.