Is there a function to modify existing previous/next post link without modifying theme files?

Yes if you just need to add a function you can put that in a new plugin.

Plugins don’t have to be complicated: a single file with a header comment will do. e.g. see the Hello Dolly plugin bundled with WordPress.