Hi Songcan,
Sorry for missing your question for so long. I hope this is still somewhat relevant, so I'll try to answer briefly.
The ΔrG'0 is actually not calculated from the formation energies, but using the group-contribution method. Since the two compounds you mentioned have groups that cancel out in the reaction (i.e. they don't change and therefore we can ignore their energy). The algorithm focuses only on the things that change, which in this case have empirically determined information. That is why we can still predict the reaction ΔG'0, but not each reactant individually.
Best,
Elad