Do flax seeds lose their fiber if cooked?
A survey paper concluded, "Heating generally changes the ratio soluble to insoluble fibre." Both forms are good additions to your diet. The way the ratio change varies from source to source, and the paper does not specify what happens to flax seeds in particular. But flax seeds are well supplied with both kinds of fiber, and unless you have some extreme requirement for one form or the other you'll get sufficient health benefits from consuming them either raw or cooked. (And if you do have extreme requirements you need a doctor's and dietician's advice on your diet.)

This site is not for nutritional advice, so I can't really address the rest of the question, except to note that the form in which you consume the different ingredients doesn't radically alter the nutritional properties. So eating X sugar and Y flour and Z flaxseeds doesn't undo anything; it just adds those amounts of nutritional components to your diet.