Not sure I understand your analogy; Neither heroin nor codeine is a root cause of problems arising from the other.
Greed (in a generous def of the word, as in the wanting/desire of as much of the thing as possible [money in this case] quickly and/or easily despite the cost) is a root cause of many of the issues people create for themselves with gambling.