Tiktok probably generated a unique link to the video just for you when you shared it so that whomever the recipient is will know that you shared it. And then your friend opened said link and tiktok connected the dots and linked the accounts in a DM with the video. Pretty easy for them to do on their end, and they probably see it as a convenient feature to users.
Also, lost fedditors
This is why I always strip everything after the ‘?’ in a URL before sharing it (e.g. ?is_from_webapp=1&sender_device=mobile&sender_web_id=7267504647052363269)
tiktok is a lot more “clever” in that regard. their short links (vm.tiktok.com or whatever) are ALL individualized, there aren’t any obvious “tracking parts” you can cut out