Correct, but why? Consider this sentence: "I like all colors, except red and green". Why in this case do we use singular, but plural for tomatoes and pumpkins? When you say "I like X, except Y", X needs to describe a collection of things, and Y needs to describe a subcollection of X.
So, when X="all vegetables" = tomatoes, pumpkins, celery, radishes, etc., Y needs to specify a subcollection. Here are possible things that Y can be:
tomatoes and pumpkins
yellow vegetables
celery
carrots
the ones Mary doesn't like
(the) ones that grow underground
the carrot ("carrots" is preferred, but when you say "the carrot" you are naming a class of vegetables, not the carrot that is lying on the table in front of you).
When X="all colors" = red, green, blue, orange, etc., here are possible things that Y can be
red and green
blue
bluish colors
purple
purples (which means colors that are close to being purple)
(the) ones Mary doesn't like
Just to confuse you a bit, it is also correct to say "except tomato and pumpkin", though using the plurals sounds a bit better. "Tomato" and "pumpkin" correctly name vegetables, so you really can't go wrong. The only way you can really err would be to mix them: "except tomatoes and pumpkin".