I believe it does come from "El general en su laberinto". I don't know how the author came up with the idea though.