Aside from earth, how many other planets in the solar system have layers?
All of them.
All the dwarf planets, and all moons massive enough to become rounded by their gravity, have layers too. It's called differentiation (https://en.wikipedia.org/wiki/Planetary_differentiation). If gravity is strong enough to make an object rounded, it will also be strong enough to separate different types of materials with different densities (e.g. rock, and metal in the Earth).