D is wrong, I thought that (D) maintaining dirt roads costs twice as much as it[maintaining] does [costs] for paved roads.
And yes it sounds bad.
it = pronoun of maintaining
does = pronoun of costs
In (B) dirt roads cost twice as much to maintain as paved roads do (cost to maintain, not just the cost of the road itself!)
Some really good instructor gave some good examples of this case:
French bulldog puppies cost more than Samoyed puppies.
French bulldog puppies cost more than Samoyed puppies do.
^^ These sentences discuss the cost of purchasing the puppies themselves.
French bulldog puppies cost less to feed than Samoyed puppies.
French bulldog puppies cost less to feed than Samoyed puppies do.
^^ These sentences discuss the cost of feeding the dogs, not the cost of purchasing them.
You do need a certain degree of parallelism. (E.g., here, "do" needs a verb, "cost", to which it can be parallel.) Beyond that, though, it's mostly just common sense.
If for some reason you wanted to compare the cost of feeding one of the puppies with the cost of purchasing the other one -- for whatever reason -- then you'd have to write a sentence that's very specific about that intention.
E.g., It costs more to purchase a French bulldog puppy than to feed a Samoyed for ten years.
Guess I got it this time!