Averages, more or less, is the easiest way to explain why they’re all on the same plane.
A big circular ball of gas has an average momentum, a very slow circular momentum. As it condenses, it speeds up, but most of the gas doesn’t have enough momentum to do anything but fall into the center (which is why the Sun is by far the largest thing in our solar system). However, some of it is either going fast enough, or will go fast enough, to maintain an orbit (or multiple orbits), these orbits then normalize with each other because one pulls another “up” while it’s being pulled “down” (up and down are relative, considering, you know, space…), they eventually reside on the same plane, no longer pulling up or down.
The stuff in orbit eventually clumps together due to static, random collisions and eventually gravity (the first two are a far larger factor in dust-clouds, where the latter becomes a larger factor later on, with larger bodies) smooshing stuff together. As bodies gets bigger, they attract more stuff.
And so on, and so on, until you’re left with a (relatively) clean solar system. In fact, other than (4, I’m relatively certain) clumps of non-planetary bodies, most of our Solar System is relatively tidy. (1. Asteroid Belt, 2. Trojans, 3. Greeks, 4. Hildas – I’m excluding the Kuiper Belt because it’s reeeeeehaly far away… but maybe we’ll call it 5.)
And all of those (except the kuiper belt) are actually caused by Juipter’s Lagrange points.
As for moons, a lot of times things get ‘caught’ (Irregular satellites), but often they form where they are because of accretion.
If they form where they are, there’s two possibilities. 1) Coalescence from an impact, like our moon. A very large object hits with enough force to eject matter into orbit, which then clumps together (in the same way planets form) to former progressively larger objects until they usually smash together to form a single large object (like our moon). Or, 2) they form where they are when the planet itself is formed (not exactly when, but in the same time frame), much like planets do around stars.
I hope my answer was helpful.