The dilemma of global public issues is a grave challenge, characterized by conflicts between rich and poor nations, and a lack of national consensus on future benefits. The impact of initial wealth heterogeneity on the emergence of cooperation in collective risk dilemmas has been a topic of intense debate. In this study, we examine the impact of endogenous endowment heterogeneity on cooperation in collective risk dilemmas. Using a two-stage game model with endogenous endowments, we investigate the dynamics of cooperation and the potential stable-state composition of the population under various parameters. Simulation results show that a higher risk probability leads to greater investment. Besides, cooperative behavior thrives when individuals are encouraged to achieve higher targets by setting small contribution ratios in multiple stages. Moreover, the promotion of cooperation by the benefit coefficient of the first-stage public goods game is influenced by the second-stage contribution ratio. Generally, a higher enhancement factor increases the likelihood of averting risk. However, when the contribution ratio is in the middle range, a moderate level of the enhancement factor yields the best performance in terms of risk aversion. Our findings have offered some information for real-life collective risk games that involve economic game relations between countries.