Create a "Paint by Numbers" script

You can see the mesh as a bitmap, there is quite no difference, except the color is on the vertex of the mesh and not on a face (pixel for a bitmap).
And as you work with a limited number of slice, it could be possible to not use mesh iso splitting but a different tool that extract faces of each color (integer indeed). This will supress the interpolation where 2 zones are separated by more than 1 unit.
The contour of the mesh is extracted and transformed to a polyline, I think it is quite the same for a bitmap.

Here it is, a script with no iso splitting. So except 2 c# there are no plugin involved !

split image color space no iso splitting.gh (22.9 KB)

It could be possible to smooth the multicolored/multimaterial mesh without generating espaces between colors.

But this script is in a dll and is not shared at the moment.
Polyline smoothing (in red the holes) vs multi material mesh smoothing