I think there may be a better way to see why gravitationally condensed structures tend to flatten as they contract. Your intuition is correct that there is no problem with orbits being randomly spread over a sphere, indeed that is just what happens to the comets of the Oort cloud in our own solar system. But the planets and asteroids are mostly in a plane, so why is that? It's because the planets and asteroids are participating in conserving the angular momentum of the original system that contracted to form our solar system.
So if the original system contained no angular momentum, there'd be no reason to form a disk. But just by chance, or perhaps by some process like eachus was describing, the original system will have angular momentum. That means the orbits will prefer, perhaps only to a very small extent, one particular direction over the opposite direction, in regard to some plane perpendicular to the vector angular momentum. Gravity is a central force so cannot change the angular momentum of a closed system, but it can make the system contract, and then an interesting thing happens.
Let's approximate the effect of the presence of angular momentum by imagining that we have two populations, a spherical population with no net angular momentum, and a disk population, all going around the same way, that carries the angular momentum. It isn't literally true, but this picture will serve. As gravity contracts the entire system, Kepler's third law tells us that the characteristic speed of the orbiting gas in both components must scale like the inverse square root of the size of the cloud. (Or if we take account of a dark matter halo, the speed grows even less rapidly than that.) But either way, this is seemingly at odds with conservation of angular momentum, which requires that the disk component, as it contracts, should have characteristic speeds that scale like the inverse of the size of the cloud, not the square root or less of that size. Since the energy requirements that give us Kepler's third law must hold true, it appears the angular momentum is disappearing for no good reason.
Since that cannot be, we find that the only solution is to move mass from the spherical component to the disk component, so the angular momentum per mass can drop without the total angular momentum dropping. This means the only way for both energy and angular momentum to be conserved requires that the cloud become more and more disklike as it contracts. Eventually, the entire cloud would be just a disk, and no further contraction could occur. However, what instead seems to happen is that some central condensation continues to occur (especially for star formation!) because there are processes that do actually transport angular momentum out of the cloud. So it's kind of a Goldilocks situation-- to the extent that angular momentum is not transported away, you get a disklike structure, and to the extent that it is, you get a centrally condensed halo-like structure, or even a central star. Angular momentum is the key attribute to follow.