I tried this and it seems to work all right: it fixes the example you showed while not causing any new failures. (Doesn't address the broken join-removal logic you showed in the other thread, though.)
While at it, I also changed make_restrictinfo to treat has_clone and is_clone as first-class citizens, to fix the dubious coding in equivclass.c that I mentioned at [1].
The "incompatible_relids" idea is a stroke of genius. I reviewed the patch and did not find any problem. So big +1 to the patch.