He had prepared his death much earlier, in his imagination, unaware that his imagination, more creative than he, was planning the reality of that death.
This, in fact, is the power of the imagination, which, combining the memory of gold with that of the mountain, can compose the idea of a golden mountain.