I doubt it is possible .. But if there is a way hopefully someone will know it and let you know
https://wowpedia.fandom.com/wiki/API_GetRaidTargetIndex
index = GetRaidTargetIndex(unit)
This appears to be the best option .. but it would still mean hoping someone in the group has them targeted and use something like raid1target as the unit id
There doesn't appear to be any other function related to this except the one that sets the icon to a unit.