You didn't mention an agreement previously. As to what you described previously, governments would contribute money to funding this research and it would be open source. Nothing stops governments from doing so already. But they don't. They obviously don't want to do so voluntarily. What you now envision is that all the governments, or most, would get together and agree to do what they don't do now. It's hard to imagine governments entering into such agreements. It's even harder to imagine them abiding by those agreements when they have previously chosen not to spend their money that way. You envision a selfless world where countries voluntarily spend money on these projects. But when it's pointed out that they don't do so, you then include an agreement. At best, what you propose would be completely ineffective. That's okay. We'd still have drugmakers. However, what worries me is that you refer to this as being part of an agreement to "socialize" things. That often means, and strictly meaning requires, that private companies be forced out of the market place. At that point, you'd be effective stopping most successful drug development in the world. I value human life too much to support what you advocate. Good intentions does not necessarily translate into good policy. Are modern drug companies full of warm and fuzzy people we'd all like to hug? No. However, they do a good job of getting the job done.
Communist countries don't have good track records in terms of advancing medical science.