Why do the planets all revolve on a plain around the sun?
Imagine the origins of the Solar System, our condensing Sun surrounded by a swirling gas and dust cloud. Early on the Sun would have been surrounded by rings of dust and gas rather like Saturn and its rings. The constant jostling and impacting would eventually favour a series of relatively thin disc-like rings all moving in the same orbital plane. Further impacting would eventually form larger bodies like asteroids and eventually planets, some rocky like Earth and some gaseous like Saturn and Jupiter. Moons would have formed about planets in much the same way, Saturn appears to be work in progress. Further gravitational disturbances, perhaps by passing meteors and comets would have thrown some of the planets out of alignment, but as you say most of them are very close to that early orbital plane.