Zhu Di was a son of the Ming founder, posted to the northern frontier as Prince of Yan, and he was not the heir. When his nephew succeeded and began stripping the princes of their commands, he rebelled, took Nanjing in 1402, and had the records rewritten to make himself the son of the principal empress rather than of a concubine. A throne taken that way needs more than paperwork, and he found the rest of it in Zhenwu, the Perfected Warrior, a Daoist deity of the north whose protection he claimed had been manifest during the campaign.
Between 1412 and 1418 he rebuilt the Wudang Mountains in Hubei as a monumental complex for that god: palaces, monasteries, nunneries and shrines strung along the ridges and up to the summit, with a hall of gilt bronze at the top. Something over two hundred thousand workers and soldiers are recorded as employed on it. The project made a modest regional cult into a state one, and Wudang has remained one of the principal Daoist mountains of China ever since, later acquiring a reputation in the martial arts that has nothing to do with the emperor who built it.
The same logic ran through the rest of his religious policy. He moved the capital north to Beijing and laid out the altars of Heaven and Earth on a scale that made the ritual calendar of the empire visible in architecture. He patronized Buddhist institutions and had scriptures printed. He was not personally devout in any single tradition so far as the record shows, and that is the point: the sponsorship was distributed, because the legitimacy he needed had to come from every direction at once.