What is the best way I could recolor all the pixels of a certain country on a texture of a political map(for achieving a map mode system such as in a grand strategy game)?

I’m using a texture of a political map where all the countries are painted with a unique color. I can assign data and know what the pointer is clicking/hovering over.
So an example of an overlay would be:

Germany is color coded gray and has a high GDP. The shader draws dark blue where all the gray colored pixels are in the texture to show a high average GDP in the area of Germany.
Moldova is color coded green and has a low GDP. The shader draws light blue where all the green colored pixels are in the texture to show a low average GDP in the area of Moldova.
The darkness of the blue is determined by a dynamic GDP value from the data of a country.
It would be very preferable if the texture of the map remains in 1 piece due to the normal map(hills and depressions)
An answer to this would be to have a conditional in the shader per color of the color coded countries, but it would be extremely slow.
Another answer would be to somehow flood fill all the countries and recolor them in order to create a new texture, but it would also be slow.

Looking to achieve such an effect as demonstrated in this video about Crusader Kings 2 map modes - YouTube

The problem with color coding (Eg. using the exact numeric value to mark a country) means you cannot use any kind of filtering (like bilinear) or mipmaps. The interpoloation would generate invalid IDs.
But IF you are OK with that (which I doubt), you could use an array of colors instead of conditionals (pick the color from the texture, calculate the array index, pick the color from the array). But you still have to implement the filtering in the shader (or have no filtering), which may be slow too.

I think the best option here would be to have separate single-channel texture for every country (also this doesn’t have to mean that each country texture covers the whole world, you’d just map it to the correct position).
Your reason for not splitting the map is “due to the normal map”. Can you elaborate on that?

Actually recoloring your map isn’t that expensive. You can use my Floodfill extension, however since you want to fill in several regions at once a slightly modified version would be better so you don’t have to use GetPixels / SetPixels for each area you want to fill. You usually don’t have to update this texture that often, only when you change the settings

It is possible to do this completely with shaders, however this requires that your color codes are an actual encoding of some sort of country index. There was a similar question some years ago about creating a selectable map. To do the overlay you just have to encode the desired tint color in a lookup texture where each pixel in that texture corresponds to one country. So in the shader you can use the color encoded index of a pixel of your map to lookup the desired tint color in the lookup texture. This would be done in the fragment shader for each pixel. All you have to do when you want to change the tinting, is to replace / edit the lookup texture. The texture could be a 1 pixel high and x pixel wide texture where x is the number of countries / destinct regions you have. However it’s usually better to create a square texture and just encode the indices row by row. With a 32x32 texture you can encode 1024 distinct areas. So a 256x256 is enough for 64k.

Since we don’t know how you actually have color coded your countries / area it’s up to you to implement this for your data.