This, what some ppl don't get is that giving these investments aren't a loss for China.Investing in 3rd world countries isn't exactly charity. It is getting rid of paper USD in exchange for something more useful (resources, markets for Chinese products and maybe some goodwill) than treasury IOU.
Modernizing NK is indeed a wise choice though.
About 100 J-10Cs, a few dozen HQ-22s and a few thousand ATGMs and drones would go far to secure NK.
Money =/= power. Power = ability to keep money circulating into projects, but not having money itself.
When China gives an investment, they move currency through their companies (can be anything, from consumer goods to electronics to construction), creating demand which creates growth for the companies. Growth translates to increased capabilities = increased national power.
So objectively China loses "money" (liquidity) but they win in what most ppl would agree is actual, usable, wealth (living standards, productive forces)
The recipient gets a handful of liquidity but this is mostly useless because almost all nations are heavily indebted anyways. If the recipient cannot use the cash to build out their own national capabilities (I.e. Functions that are natively owned), they do not benefit in terms of increased national strength.
Chinese international circulation of RMB and Dollar serves to keep China growing in terms of production capabilities, market share etc. Which are the actual metrics through which "wealth" is decided, not liquid cash that can be printed by the PBOC or gets acquired by the bucket load from trade that serves to further rev up local business by passing money through them.