Interesting idea, but to me personally it is easier to generate separate G-code files for each material. The CAM/CAD software I'm using (CamBam) has a nice way to handle it - so-called "CAM styles" where you specify tool diameter, feed speed, spindle speed, depth of cut, milling direction and other parameters. Changing a program from wood to aluminum takes me just a few mouse clicks.
Also, this allows me to switch from climb cutting for aluminum to conventional cutting for wood. Or from 1/8" tool for wood to 1mm tool for aluminum. Or, say, from holding tabs for wood to "onion skinning" for aluminum. Would be pretty challenging to do by modifying variables in the G-code.
P. S. Not trying to discourage you in any way, your idea is very cool, especially if you are dealing with a range of relatively similar materials.