Edit
I think I know what is happening, and is a great example of why, in order to avoid a choice * in the first place.
First you defined a table with childId, then parentId, but CTE Foo expects parentId, then childId,
, , # bar. * childId, parentId, parentId, child. n-, .
, SQL.
: * .