Hi Frank,
I use a software utility called Autoleveller. It is primarily designed for use when isolation routing of circuit boards.
Any variation in Z height due to either machine inaccuracy or PCB blank warp/bow/twist causes a very great loss of quality of the
finished job. Autoleveller causes the PCB blank to be probed at close intervals AND THEN uses that height variation data to modify
the Gcode, in particular introduces small variations in Z to match the bow/warp of the blank. It breaks large linear moves into smaller
moves to apply a varying correction, much like I have suggested your lathe correction program would be required to work.
There are some similarities between Autoleveller and what you want to do.
Autoleveller is open source so you can easily see how they have done it. It is written in Java.
http://www.autoleveller.co.uk/Craig