You have link_counts, so you could add correct ordering there, but preserve links as is in a future version of Discourse, or maybe add a ‘links_raw’. If you would accept a new JSON property that offers links in the correct order then I can PR this.
I will have to work around this temporarily by taking cooked and taking links from that or patching Discourse.
Sam