Ok, to answer my own question (solved by accident): it seems that when adding subquestions, the question id qid needs to be provided, but it doesn't need to be correct - just the correct order will do.
That is, the parent question can have a qid = 1 then the subquestions can have qid = 1 + i
it's important that when adding subquestions from scale X and scale Y, they all need to have the correct order; so
for Y it'll be qid = 1 + i, and for X it will be qid = ySubQ.length + 1 + i