Impurities From Purity
That’s just how things work in this universe. Out of najis soil comes pure food, and after consumption it turns back into najis substance.
Logic is not something absolute that lies outside of this universe. When we look at things in proper perspective, it’s perfectly logical.