You basically had the right idea about breaking it down by color channel.
Here's one example of how you can solve this:
Using RGB and black to create a 4-texture blend map

I could have used the alpha channel, but opted for the absence of color (black) instead to represent the fourth channel because you can't see the alpha channel in the 3D Viewport or paint it in Texture Paint Mode.
This is what the node setup looks like (Blender Internal):

What's happening in the node setup
From the 'Blend Map' texture the RGB channels are separated and each one used to additively factor in the color of the texture against solid black.

The RGB Curves node just gives enough of a boost that the transitions between regions won't look dark. (Mute the node in the .blend to see the difference it makes.)
The ColorRamp and Invert nodes isolate the darker parts of the blend map and that becomes the fourth channel mask (black).

The Material node receives the final additive mix of color data (the four textures) and applies it to a material created just for this node setup that I named 'NodeComponent'. This is just the quirky way of doing things in BI's nodes so that the material will receive specular highlights and not be shadeless.

For cases when you need more than four textures, you can repeat the blend mapping process iteratively. So for example, within the red region of the blend map there could be another blend map with its own red, green, blue, and black regions. So you could use the first blend map to control what kind of terrain (grass, sand, snow, stones), and then the second level blend map to map out the grass textures within the grass region. In such a case it would be best to create a Group node and reuse it for each blend map, to keep your nodes manageable.
Getting it into your game
As for exporting, you can bake your blend map to a new massive texture, but it wouldn't be good for a game because such a large image would need to be generated. It's better to use the individual tiling textures and the blend map to combine them. I don't know what game engine you plan to use, but if you are using the BGE or Blend4Web you can use this node setup as-is. For other engines you should look into what kind of data those engines expect for a blend map.
*Terrain material is set to 'Shadeless'. Turn off 'Shadeless' to see lighting.