"Could the car be programmed to have the following distance the length of towbar plus 2 inches when going down hill, and minus 2 inches going up?"
It could be and that would greatly simplify the requirements for self driving since all it would have to do is follow the RV. But, I like the idea of getting there with the vehicle most charged which it could certainly do by aggressive use of regen when going downhill and stopping. Plus, there is a chance that your "toad/follower" vehicle would give out of juice and not still be behind you when you stop.