From personal experience, I can count on one hand the number of times that wd40 (edit: at least the canonical formulation) has been the best lubricant for a given application.
yeah, most of my use-cases for classic wd-40 have always been getting things unstuck rather than long-term lubrication. The lubricating action tends to evaporate with the solvent(s) and leaves, as you've pointed out, the famous gummy residue that is good for keeping moisture out but not at being a lubricant