My research into why this happens led me a bit astray. Everything I found talked about regular orange carrots turning green, and the culprit was baking soda. The orange carrots in my cake were fine though -- it was the purple ones that were the issue. I suspect it was probably still the acid in the baking soda, though.