We already know the solution, the technology just isn’t there yet.
The solution is lab-grown organs. You don’t need to worry about rejection if the cells come from the patient themselves.
And… That’s really it. With how insanely complicated and individually tailored our immune systems are, it’s easier to find a way to grow an organ than it is to find a way to guarantee compatibility with a donated one.