That's not true. With the discovery of over 4000 exoplanets since 1992, it was discovered that planets with orbits that are highly inclined relative to the plane of the ecliptic are common. This was a surprising discovery because before that we only knew one system, our own Solar System, where all the major planets orbit close to the Sun's equatorial plane. Here is a quote from an article written in 2016:
"To date, astronomers have measured the orbital inclinations of 91 exoplanets and more than a third (36) move on orbits that are significantly misaligned, tilted by more than 20 degrees."
https://theconversation.com/stars-with-planets-on-strange-orbits-whats-going-on-56511
It's true that most of these planets with highly inclined orbits are gas giants similar to Jupiter, not smaller rocky planets like Earth. Many are so-called "hot Jupiters" with very short orbital periods (a few days). The theories proposed to explain their highly inclined orbits are usually based on migration. The planet originally formed further away from the star in an orbit in the star's equatorial plane, as expected from the standard theory of planetary formation. But its orbit was later disturbed by some large body in the same system, such as another star, which caused the planet to migrate closer to the star and its orbit to become highly inclined.