Subquery unnesting investigation

Development of the correlated subquery unnesting feature in PostgreSQL (project) de-facto stopped by the problem.

EXPLAIN VERBOSE
SELECT * FROM a WHERE EXISTS (
  SELECT * FROM b WHERE b.x IN (
    SELECT c.x FROM c WHERE c.y = a.x
  )
);
Seq Scan on public.a  (cost=0.00..0.00 rows=1 width=4)
   Output: a.x
   Filter: (SubPlan 1)
   SubPlan 1
     ->  Nested Loop  (cost=0.00..0.01 rows=1 width=0)
           Join Filter: (b.x = c.x)
           ->  Seq Scan on public.b  (cost=0.00..0.00 rows=1 width=4)
                 Output: b.x, b.y
           ->  Seq Scan on public.c  (cost=0.00..0.00 rows=1 width=4)
                 Output: c.x, c.y
                 Filter: (c.y = a.x)

Rewriting the query (I guess, semantics is the same) we get:

EXPLAIN VERBOSE
SELECT * FROM a WHERE EXISTS (
  SELECT * FROM b JOIN (
    SELECT c.x FROM c WHERE c.y = a.x
  ) AS q ON (b.x = q.x)
);
 Seq Scan on public.a  (cost=0.00..0.00 rows=1 width=4)
   Output: a.x
   Filter: (SubPlan 1)
   SubPlan 1
     ->  Nested Loop  (cost=0.00..0.01 rows=1 width=0)
           Join Filter: (b.x = c.x)
           ->  Seq Scan on public.b  (cost=0.00..0.00 rows=1 width=4)
                 Output: b.x, b.y
           ->  Seq Scan on public.c  (cost=0.00..0.00 rows=1 width=4)
                 Output: c.x, c.y
                 Filter: (c.y = a.x)

Error:

ExceptionalCondition (conditionName=0x562ecd501296 "root->hasLateralRTEs", errorType=0x562ecd3f2061 "FailedAssertion"

which jointree exactly breaks it?

root->parse->jointree
$2 = {type = T_FromExpr, fromlist = (1 JoinExpr elem), quals = NULL}
{type = T_JoinExpr, jointype = JOIN_SEMI, larg = 0x562ecf673698, rarg = 0x562ecf673448}
**larg:** FromExpr, fromlist={1 RangeTblRef elem}, quals=NULL
**rarg:** FromExpr, fromlist=NULL, quals=0x562ecf673d38
larg->RangeTblRef: rtindex=1 ("a")
rarg->quals: RangeTblRef, rtindex = 2 ("b")

The answer is: we transform SubLinks from upper sublink recursively to lower sublink. So, replacing "IF EXISTS" with SEMI JOIN we should pass down this semi join and in an underlying SubLink check for lateral links.