You could create a hidden value inside of the repeat which is set to either the child_id (if one exists) or a random value if child_id is blank. I'd suggest using the uuid() function, which is effectively guaranteed to produce a string which won't match any other string.
Setting the out-of-repeat-group count summation to the new hidden value instead of the child_id should provide the intended behavior.
-Clayton