Is plaque formed even if you do not eat anything?
But I always assumed that plaque is formed by food remains in the mouth

It's not surprising that you'd have this assumption. The clinical term, dental plaque, refers to soft deposits on the teeth. While is often described to the lay public in connection to eating (without brushing), it is not food, or the remains of food, it is a biofilm. Biofilms are complex masses of bacterial colonies in a gel-like matrix produced by those same colonies. The matrix typically, helps the colonies adhere to some surface and protects them from external threats.
Good supporting electronic references of what, exactly, a dental biofilm is and how it impacts the health of your mouth and body are behind a paywall, but you may be able to access them at your local public or school library. Socransky and Haffajee have a good review in Periodontology. You can find it on Pubmed (behind a paywall).
As you suspected, not eating does not prevent plaque formation, but it is not because your teeth are excreting sticky toxins. Your mouth is full of bacteria, most of which lives peacefully without causing any problems. They're the ones that make the plaque, and they will make it whether you eat or don't. Whether or not those bacteria are more likely to cause problems (e.g., cavities and gum disease) if you fast is a question for future research.
There is some evidence that the bacterial composition in the mouse gut changes when they fast, and that obesity is associated with periodontal disease in humans. There is some interesting evidence in support of effects of intermittent fasting that would make it reasonable to ask a research question about the impact on dental caries and periodontal disease, but that evidence isn't enough to support fasting as a treatment for any disease.
tl;dr
Plaque is (caused by) bacteria, not food. It's produced whether you eat or not. Fasting is certainly not an approved treatment for periodontal disease or cavities, and I'm not aware of any direct evidence supporting it.