Unfortunately, I think you have a problem with your MEL-NAN-MEL segments
QF does not fly this route, neither does JQ. Instead QF codeshares on FJ and such codeshares are not allowed
Does it have to be MEL?
This routing gets around both the flights to NAN problem and the extra SWP segment:
CPT-JNB-HKG-SYD-WLG-SYD-NAN-SYD-JNB-CPT
QF codeshares on the JQ flights SYD-NAN-SYD and these are allowed
And cheap flights SYD-MEL can be had for far less than what you would pay for the 5th SWP segment.