AS GLC stated, the yolk emulsifies the fat, allowing it to combine smoothly with the water in the batter. But it forms other functions as well. The yolk thickens as it cooks, and acts as a binder. Think of how egg yolks thicken a pastry cream. The egg white adds protein. This helps the crumb stick together. To understand the process, try this experiment.
Make a batter by combining 1 large egg with 3 tbs. of cooking oil whisked together. Set aside. Place 1 cup of flour into a bowl, along with 2 tsp, baking powder, 1/2 tsp. salt, and 2 tbs. sugar. Whisk these ingredients together to combine. Add 3/4 cup of milk to the flour mixture and cook two tbs of the batter as a pancake on a griddle. Notice how the pancake will puff up, then fall, and is easily broken. It has little body.
Now, add the egg to the batter, whisk in and repeat the pancake test. Notice the difference in texture. The pancake is lighter, more fluffy, as it has the required structure to capture and hold the little CO2 bubbles.
Finally, add two more eggs to the batter and whisk them in. Again make your pancake. notice how the pancake has become somewhat rubbery. This is due to the extra protein from the egg. Some deserts are made this way, such as bread pudding. The egg texture becomes noticeable in the end product.
If you desire your cake to be more moist, try adding an extra 2 tbs. of cooking oil to the original recipe. That will make the cake feel more luxurious, and moist. Too much oil, though, will make the cake heavy, and downright oily feeling. I had a carrot cake recipe given to me that had far too much oil in it. I though that I could pick up a piece of the cake, and squeeze it like a sponge to remove the extra oil. I cut the oil in half and had a very moist and fabulous carrot cake recipe that I use to this day.
Egg is necessary, but in the correct amount. If you try the experiment I gave you, it will be apparent to you what egg does when mixed with flour, water, and oil. Use this knowledge for cakes, quickbreads, cookies, and so on.
A note: Eggs can be used as a leavening agent, as when used to make pop-overs, dutch babies (a kind of pancake), and Yorkshire Pudding. It's also what makes eclairs, puffs, and profiteroles puff up as they do. The egg, flour, and dairy combine to create a batter that holds together very well. High heat sets the outer layer of the pastry so that like bubble gum, it holds in the expanding air and steam as the pastry cooks, creating a hollow end result. When the pastry is finished, the shell is firm enough to retain its shape as the steam and air inside it cool.
That should help you understand what's going on in your pastries.
Seeeeeeya; Chief Longwind of the North