The Ramchal says in Derech HaShem that the greatest good imaginable is HaShem himself. Does anyone know an earlier source for this statement?
There might be a misunderstanding about what the Ramchal is saying. I don't believe he writes the greatest good is Hashem. He writes that Hashem wants to bestow the true good on man which means allowing man to attach (dveikut) himself to God through commandments (mitzvot).
Therefore since Hashem's will is to bestow good upon others it will not suffice Him to bestow only a small amount of goodness. Rather when He is bestowing the ultimate good possible for created beings to receive. And since Hashem alone is the true good, His desire will be satisfied only when He is benefitting others of that very selfsame goodness that is intrinsically a part of Himself, i.e., goodness that is perfect and true.
When you look further into the matter, you will see that true perfection (artscroll: which is the ultimate good) lies only in clinging to G-d. This is what King David said "But as for me, closeness to G-d is my good" (Psalms 73:28) [...] For only this is the good, while anything besides this that people consider good is really emptiness and mistaken worthlessness. For a person to attain this good, it is proper that he first exert himself strenuously to acquire it, namely, to exert himself to cling to the blessed G-d through the power of deeds whose consequence is this end. These deeds are the commandments.
See also this related answer: what is good and what does it mean that God is good?