When I first heard this what I was told is that formaldehyde is used also in the making of gelatin capsules.
Aldehydes are formed from the breakdown of alcohols. Ethyl alcohol forms acetylaldehyde, which is what causes the hangover. Formaldehyde is formed from methyl alcohol, such as from the breakdown of Aspartame (Equal, Nutrasweet).