Free Y mode allows each row to be calculated separately so as additional segments are added I'm afraid you will end up with that problem. Another though option could be to use Material IDs set on the spline. In that way you can use Free Y mode and maintain coordinated blocks of colour. All you need to do in this case is use a Selector node set to Material ID
I've attached a sample file. I hope that helps, please let me know if you have any further questions.