Students in my English classes unfortunately wrongly use 'cook' when flour-based food items are prepared in an oven. Most of my students are Spaniards and they do fall into this trap time and again. When preparing a cake, biscuits, croissants, pies, pizza etc in an oven, do use the transitive verb ‘bake’. So do not say 'I will cook a cake in the oven'. This is incorrect and it sounds awkward. Please use the verb 'bake'. The correct sentence here would thus be 'I will bake a cake in the oven'.
However, there is a food group where you could use either the verb 'cook' or 'bake' when prepared in an oven. This is food such as 'pies', 'tarts' and 'pizzas'. We could use either verb ('bake' or 'cook') since a significant amount of their content is vegetables, fruit, meat or fish. In other words when the proportion of flour content is reduced significantly and replaced by vegetables, fruit, meat or fish, you could use either verb.
Notwithstanding this, as is common in English things become rather trickier as you can actually also 'bake' fruit-only and vegetable-only products in an oven. This online dictionary (https://www.macmillandictionary.com/dictiona…/british/bake_1\) talks about 'baked apples'. In addition, in the UK we also eat 'baked potatoes' (otherwise called a 'jacket potatoes' by my parents) prepared in an oven. 'Baked potatoes' have no flour whatsoever. In the US of course there may be other non-flour products one bakes and perhaps some of my American colleagues on Verbling would be kind enough to point these out.
In conclusion, as one of the best UK native teachers around with over 8,000 English classes done and a Masters in Translation, you can trust me to point out that 'bake' is most commonly used used with flour-based products prepared in an oven. Hence the shop where you buy bread: 'a bakery'. I hope this helps and feel free to message me about any grammar point in English you may be unsure about. I do endeavour to reply to everybody. Have a great day!