AFAIK general style guides don't recommend using thousand separators in numbers below 10000, so "variable #1,234" is not quite good, it should've been simply "variable #1234". "Variable 12,345" would've probably been OK, but then there's another semantic issue: thousand separators are only used in numbers that mean quantities, not identifiers. Long numeric identifiers like phone number or SSN are usually separated di…
I also still think an alternative world where we decided to use font shaping for digit grouping would work out better, it would just maybe have different conventions. Numbers that you manually separated wouldn't be touched anyways unless you use any group longer than say 4 digits.
For contexts with long identifiers that don't represent quantities like database IDs there could be a stylistic convention of prefixing them with a @ or something instead of a manual stylistic convention for quantities. Then maybe your font could do something cool to make it easier to tell when two big ten digit random numbers in a column are the same, like a pattern of underscores based on hashing. Also having digit grouping in your meaningless IDs is way less of a problem than not having digit grouping in your quantities.