First of all, just about any food of reasonable size is safe to be cooked in a microwave, assuming you do it correctly.
I heard that meat isn't safe to bake or grill in microwave because
there may be tiny areas that contain less moisture and hence not
cooked though as microwave cooks moving water molecules.
I'm not sure what the source is for this, but it's not true in general. One can't really "grill" meat in a microwave, but one can bake/roast it. It's true that microwaves heat unevenly, so for thick cuts, that means cooking using a lower power level and/or cooking in stages. Most microwaves with lower power settings actually just cycle on and off, which allows the heat already present in the food to distribute itself farther inside. It's not unlike the process by which you roast meat in an oven: the outside heats faster, but the interior has no direct contact with the hot air, so you depend on the fact that the heat will gradually be conducted throughout the food. Microwaves instead target water molecules (as you note), but with periodic heating and enough time, the hot parts of the food will heat up the rest.
(If there is one thing to note about microwaves, it's that people tend to just use them on high heat, expecting them to cook faster. If you want to cook a large cut of meat, you need to allow time to distribute the heat while cooking, which means you can't cook very fast or you'll dry out some parts completely before the rest gets done. Perhaps that's where you've heard about the "safety" issue -- people who have used microwaves incorrectly to try to cook large pieces of meat too quickly and ended up with parts that were still raw. Like any cooking tool, microwaves need to be used correctly for different applications.)
Anyhow, to the question about baking: yes, microwaves can be used safely for baking too. Browning is harder to achieve in microwaves (though it can be done in some limited ways, and there are gadgets to enhance it somewhat). Pies baked in microwaves generally will bake the crust first for a few minutes before adding filling to ensure the crust bakes better. It won't brown much and likely won't have a very nice crust texture (particularly if you like "flaky"), but it's perfect safe. The results overall will vary based on the type of pie (though reading a bit online seems to indicate that custard pies are often a good candidate for microwaving).
As for bread, again, it's perfectly safe, and there seem to be several online recipes for it. Again, you won't get much of a crust or browning, but if you don't like a dry crust on your bread, it might actually be an okay option. Typically, you should get a result closer to a "steamed bread" rather than a crusty bread, which might be feasible for some types of bread. (Cakes are often a better option for baking in the microwave, as they often don't require browning or crust development for good results.)
In general, it's perfectly safe to bake dough in the microwave as long as your final result is done all the way through. I'd do a search for some recipes with good reviews or from a reputable source before trying them, though, since a lot of baked goods made this way tend to be inferior to those made in a more conventional oven.
EDIT: While the question asked about food safety, I found some general guidelines on baking in the microwave that may address the quality issues that came up in comments. For bread:
- Select whole grains or products finished with a topping or icing as microwaving does not brown the bread crust.
- Microwave yeast breads at 50% power and rotate at least once.
- Reduce baking powder by at least one fourth in coffee cakes.
- Use extra shortening in yeast and quick bread to prevent toughness and dryness – 1/4 cup shortening per 2 1/2–3 cups flour in yeast bread
and 1–2 Tablespoons of shortening for every cup of flour in muffins
and coffee cakes.
- Decrease liquid in dense quick bread batters or very liquid batters. Additional egg can be used as a binder in very liquid
- Bread must be heated uncovered to avoid sogginess.
For pies, the document notes that "fruit pies will become soggy" by the time they bake completely and:
Double crusted pies cannot be made in the microwave as the bottom
crust becomes soggy and the top does not brown. Microwaved pies need
to be prepared in a precooked shell and topped with a crumb rather
than a crust.