I find this sort of problem is most easily solved using music21.
Here’s quick 'n dirty routine to do what you want
rotate-contour.zip (1.1 KB)
And here’s the output…
With a little tweaking you could export your phrase from Dorico as an xml, manipulate it using music21 and re-import to Dorico. (There’s a thread on setting up Dorico for music21 here.)