That is not even syntactically close to a sequence of two nested arrays, I am afraid.
How do you think about to extend an XQuery sccript variant like the following for the desired transformation?
declare option output:method "csv"; declare option output:csv "header=yes"; for $x in (["f", [1, 2, 3]], ["g", [4, 5]]) return <csv> <record> <key>{$x(1)}</key> <values>{$x(2)}</values> </record> </csv>
Test result: key,values f,1 2 3 g,4 5
Regards, Markus