While rumtscho's answer is literally correct, the word "caramelization" when applied to onions includes lots of things other than literal caramelization. Yes, actual chemical caramelization turns sugars into other things (including some flavorful components). Similarly, Maillard reactions will convert sugars and other components together into flavorful components that are no longer sugars.
But that does not mean that "caramelization" as the word is typically used cannot increase the sugar content in a food. When you "caramelize" onions, for example, you are not only producing the browning reactions that increase flavor components as mentioned above. The long heating process also breaks down some complex carbohydrates into more simple short-chain components, i.e., sugars. Starches can convert to sugars. Long-chain sugars (polysaccharides) that wouldn't typically taste sweet can be broken down into monosaccharides (like glucose) and disaccharides (like sucrose, otherwise known as table sugar) that taste sweet. Technically, this process isn't part of the chemical process of caramelization (or pyrolysis, for that matter), but it will happen during the long cooking/baking process when you "caramelize" (in the informal sense) most foods.
In that sense, the cooking process needed to "caramelize" onions definitely increases the sweetness of the onions by converting complex carbohydrates into simpler ones, including sugars. By doing so, you are not increasing the overall carbohydrate content of the food. Your digestive system will ultimately break down many carbohydrates into sugars anyway, but by cooking the onions, you are freeing up the simple sugars so you can actually taste their sweetness. (As rumtscho notes, nutrition is off-topic here, but basically simple sugars are more quickly digested, so any process that breaks down carbohydrates could affect the way the human body responds during digestion.)
Furthermore, if you think of sugar content by weight, then the cooking process that creates "caramelization" most definitely can concentrate the sugars and result in a higher sugar content by weight. To be clear, if you add, say, "one onion" to a dish, the total number of carbohydrates won't vary much whether you add that "one onion" in raw form, or in a sauteed form, or "one onion" in a caramelized form.
However, if you were instead to add "100 grams of onion" to a dish, the form of onion definitely matters. 100 grams of raw onion won't contain much sugar at all. But if you cook onions for a long time, you will evaporate a lot of moisture, thereby increasing sugar content by weight significantly. Thus, 100 grams of caramelized onions will definitely increase the sugar content of a dish. (Note, however, that you'll require a lot more onions than 100 grams to make 100 grams of caramelized onions.) My point is that even a little caramelized onion can add a lot of sweetness, and it will be more perceptible due to the concentration of the sugars (with much of the moisture of the onion removed) along with the breakdown of carbohydrates into smaller and sweeter molecules. A similar process increases the apparent sweetness in your example of baked apples.
To answer your questions more directly and concisely: the cooking/baking process of "caramelization" in many cases will transform carbohydrates into other forms of carbohydrates. Typically, long cooking/baking will break down some complex carbohydrates into simpler ones, including simple sugars. (This is not pyrolysis; just breakdown of sugar chains under heating.) Chemically, this may result in increased "sugar" content in a food, along with decreased complex carbohydrate content. To put that last point more clearly, plants store energy in very large, long molecules that might contain hundreds or thousands of simple sugars bonded together. When you heat plant matter, you begin to break down those bonds, producing what are colloquially referred to as "sugars." During cooking, you are releasing their sweetness and making the food quicker and easier to digest.