I see a solution here, however there seem to be no direct way to open links in chrome without bringing chrome window to foreground.
Use Chrome Remote Debugging Protocol. The browser has to be run with param --remote-debugging-port=9222
. Actually, all instances of chrome have to be closed first. Then chrome can be controlled via this API. There is a client for it in most major languages, e.g. node:chrome-remote-interface.
I believe this is how also vscode does it, however they can do it even without remote-debugging-port parameter on the chrome instance.
So to complete the task in my original question, u need only to write some script that makes use of installed Debugging Protocol client of your choice.
Update: this also brings chrome to foreground (only if the window is hidden behind another window it doesn't). For definitive solution use chrome extension with tabs API (I am afraid this is necessary).