Well, the best way to go about making it upgrade-proof it is to make it a plugin. To do that, I think you would copy that function into a new .php file, give it a new function name like
markys_get_links_list, make the edits, and save it to the plugins directory. Then in your files, you would call the
markys_get_links_list function instead of the hacked
I haven't taken the time to read the WP plugins documentation but I think that's really all there is to making a new plugin, short of credits, authorship, description, comments, etc.
Ideally, the WP dev team would catch on and rewrite the links functions to accept 'before' and 'after' parameters like other WP functions.