Zhuge Liang chose the Northern Expedition because it was actually the most favorable situation for Shu at that time.
According to the situation of Shu at that time, the Northern Expedition was the best choice. By the time Zhuge Liang chose the Northern Expedition, the three kingdoms were divided, the world was divided into three parts, other vassal states were eliminated, and the world was basically formed. At this time, Shu had no choice but to attack Wei, and Wu still rested and did nothing.
Among the three countries, Shu has the smallest land area and the least population, so among the three countries, Shu has the lowest growth ceiling and the lowest height it can reach. Moreover, compared with the Central Plains, which suffered huge losses in the early days of hegemony, Bashu's losses were relatively small. Under such circumstances, Zhuge Liang's Northern Expedition may be the time when the relative gap between Shu and Wei was the smallest. If the Northern Expedition is not carried out at this time and the Shu and Wei countries recuperate, then the final result will only be that the gap between the two sides is getting bigger and bigger. Just like you are inferior to others, you dare not gamble, so there is definitely no chance to surpass you.
In fact, this situation has been very obvious in the later period of Shu State. In the later period of Shu, compared with the other two countries, there was an obvious shortage of talents in Shu, which was based on the statement that there was no general Liao Hua as the pioneer in Shu. This is because when the situation in the three countries is basically fixed, it is difficult for Shu to obtain talents from other regions.
Is the demise of Shu directly related to Zhuge Liang's recuperation? Zhuge Liang's Northern Expedition didn't mean that it consumed the national strength of Shu, but that Shu perished 30 years after Zhuge Liang's death. Even if Zhuge Liang doesn't rest, 30 years will be enough if anyone is willing to rest after his death. Therefore, there is no direct connection between the ending of Shu and whether Zhuge Liang went north.
Of course, if Zhuge Liang had not made the Northern Expedition, Wei also had a high probability that Sima Yi would not be used against Zhuge Liang. Sima yi probably won't have a chance to make a comeback, and Wei's fate will change.