Find Confluence page, move it beneath a similarly titled page?

I have some Jira Cloud automation set up. It creates a Confluence page from an Issue upon issue completion. If that Issue later gets a sub-task, a new Confluence page will be set up for the sub-task. This is working fine.
But I then need to somehow, within Confluence I assume, move the sub-task page beneath it’s parent task’s page.
I’ve struggled to figure out how to grab the new sub-task page’s title, compare/regex it to the title of another parent issue page to ID where the sub-task’s page should become a child of.
i.e. When a sub-task’s page is created, find it’s parent, and move the sub-task below the parent.
I’ve tried both Jira and Confluence automation, and done some ScriptRunner tinkering, but I just can’t figure out how to accomplish it.
Can anyone point me in the right direction, or share their solution if they’ve achieved this or something similar?

Thank you.