Any suggestions for pulling specific players towards each other?

I'm trying to make a datapack that mimics the game Chained Together, but I'm running into a few hurdles.

My current idea is to have a /link command that applies matching/mirrored tags to two players. I want players to be able to have multiple partners as well. Then on every tick I want to pull each pair of players together, with the strength of the pull being stronger the further they are from each other. For the pulling I found the player motion library (https://modrinth.com/datapack/player_motion) which seems to fit my use case pretty well. I don't really care too much about there being visible chains or ropes between players, but if possible I would like to maybe add this at the end.

I got my /link and /unlink commands to work properly; they basically just add player 1's name as a tag on player 2 and vice versa. The problem I'm trying to solve now is figuring out how I can select a pair to then apply the pull effect. I was initially thinking about something along the lines of execute as @a run function pullfunction {tag:NAME} where pullfunction would pull all players with the tag NAME towards the executor, but I can't find a way to actually get the proper tag into the command since it's not static. I've tried using player names as tags, as well as ids stored in the scoreboard as tags, but both have the same issue. I'm not really sure how I can either solve or circumvent this issue.

I also wanted to see if my logic for the pulling part is sound. I was thinking of using the positions of player1 and player2 to obtain a vector from player2 to player1, scaling it by some factor, and then adding the resulting vector to player2's velocity using the player motion library. Then repeat for all pairs of linked players. I assume that I would have to store the intermediate calculations in the scoreboard somehow, but there might be a better method.

I'm a beginner at making datapacks so I'm not really sure if this is a feasible idea in general. Any help is appreciated, thanks!

Continue to help post