The Matnas Kehuna actually writes that the point of the medrash rabba so as not become impure, actually means so as not to become dirty.
שלא יטמא. כלומר שלא ילכלך ויטנף אותו.
Pirush Maharzo quotes this Matnas Kehuna but offers a different explanation. He suggests that considering how Kozbi was speared, the blood under discussion was actually blood from her makor, dam nida. Which is only impure on a rabbinic level by nonjews, but nonetheless, this miracle spared Pinchas from even that.
שהרי דם זה בא מן המקור שדקר אותה שם והוא טמא ומטמא עכ׳פ מדרבנן בעובדי כוכבים
Edit: If we take this idea of the Matnas Kehuna into consideration and assume that the miracle spared him from a rabbinic impurity, then we can suggest another idea based on a comment from @msh210.
There is something called Dam Tevusa. This is a blood which came out of a dying person which later mixed with blood that came out of him after he died. The details are subject to dispute in the linked mishna, and Rambam rules in accordance with Rabi Akiva there. But according to all opinions there is at least the possibility that the blood coming out of Zimri could theoretically combine with blood that came out of his body after he died and combine into a riviis to render Pinchas impure, at least on a rabbinic level.
This of course is a further step removed from the actual rabbinic impurity mentioned by Matnas Kehuna, as this blood is only a precursor to the blood from after death. However, it is something that could theoretically be impure, that a miracle would be appreciated to save him from.