It evidently wasn't ever *tested*, but in principle I think it ought to work. I'm not sure how much effort will be involved to make that happen. At this point we might have to disallow it for v15 and come back to the problem later.
Seems we neglect to think of MERGE statements when we transform WITH clauses and when we rewrite the query. If we add the check against MERGE statement in parse_cte.c and in rewriteHandler.c, the query in problem can work. But I'm not sure if that's enough.