Temporarily disabling the setrefs.c crosscheck shows that it's trying to create this plan:
which is the wrong join order: the filter condition can't be applied at that join level. So the nullingrel cross-check has caught a real bug, but why the bug?
FWIW, I found that we have an existing test query in sql/join.sql that almost exposes this issue.
explain (costs off) select * from int4_tbl t1 left join ((select t2.f1 from int4_tbl t2 left join int4_tbl t3 on t2.f1 > 0 where t3.f1 is null) s left join tenk1 t4 on s.f1 > 1) on s.f1 = t1.f1;
If we change the WHERE clause to 't2.f1 != coalesce(t3.f1, 1)', we will see this issue.
explain (costs off) select * from int4_tbl t1 left join ((select t2.f1 from int4_tbl t2 left join int4_tbl t3 on t2.f1 > 0 where t2.f1 != coalesce(t3.f1, 1)) s left join tenk1 t4 on s.f1 > 1) on s.f1 = t1.f1; ERROR: wrong varnullingrels (b) (expected (b 5)) for Var 6/1