Well, you're right when you say:
If you need to iterate over the same template, like in alternating table row colors, just do it in the programming. That is what programming is meant to be, control the program output logic flow.
However, how should the programmer know which color to iterate over and how to specify it? It's the HTML designers job to say "use color a and b". The programmer tells the designer that this row will be repeated for an unknown number of times and then the HTML designer has to come up with a good representation.
I don't see what's wrong with this.