The toxicity of any chemical is always dependent upon dose. The ethyl alcohol in the wine you are trying to make is toxic, if you drink too much of it.
I remember hearing somewhere that when you eat an apple - the very fruit that if you eat one a day is meant to keep the doctor away - the digestive process that apple undergoes within the human body will actually produce a small amount of formaldehyde within your body as part of the complex chain of bio-chemical reactions that take place as food is processed and turned into energy.
I did some googling to check my memory on this fact, and I believe it is correct:-
Toxic formaldehyde is produced inside our own cells, scientists discover
https://www.sciencedaily.com/releases/2017/08/170816134721.htm
Formaldehyde in Food: What You Need to Know
https://www.verywellfit.com/formaldehyde-in-food-what-you-need-to-know-4692816
Formaldehyde is one of those nasty sounding chemicals because of its association with embalming, and it is indeed toxic if ingested at un-natural levels. Certainly, one wants to keep exposure to a minimum (0.2 mg/kg of body weight, according to above website).
There are a few comments in these forums of some winemakers mentioning off-smells in their wine when its gone wrong as being like formaldehyde. This off-smell fault might possibly be due to some microbial or bacterial infection converting the chemicals in the wine into formaldehyde or a similar smelling chemical.
This fairly detailed document on wine faults (
https://cdn.homebrewtalk.com/data/attach/726/726091-Wine-faults-1--1.pdf) doesn't mention formaldehyde at all, but it does mention off-odors like ethyl acetate (smells similar to nail polish) which maybe someone else thinks smell like formaldehyde. (Personally, I'm not sure if I've ever smelled formaldehyde, and if I have I've forgotten what it smells like, so I can't comment.)
I think, in summary, if you follow good cleanliness and sterilisation procedures when making your wine, keep the bugs and fruit flies away, and do secondary fermentation under an airlock attached to a bung that froms a good airtight seal, you shouldn't have anything to worry about from formaldehyde in wine.