Headers (including the Set-Cookie header) are generally added to the end of the existing headers. If you want to change the order of the cookies in responses, I think you'd need to save each Set-Cookie header value in an array, remove the header and then re-insert each of the headers in your required order. This could be a bit resource intensive to do for every response.
Can the app be modified to parse the cookie headers anywhere in the list of headers? If so, that would be the most efficient fix.
If you do need to use an iRule to do this, what version are you running? The reason I ask is that the handling of multiple headers of the same name was changed in 9.4.0.
Aaron