In this case nature was just indifferent to transplants as they weren't a thing even 100 years ago.
As others have explained, foreign cells usually meant trouble, so fighting them by default was a good choice. And there was no pressure to allow transplants specifically, because they didn't exist.
Also, (I think) you usually need a transplant later in life, after reproduction, so too late for evolution to affect it. So even if we had transplants for millions of years, it might not have made much difference either.