This is true of Earth’s magnetic field. But there’s no reason that a planet with a solid core couldn’t have a magnetic field due to a permanent magnetization of the core as the planet cools. I mean, first there’s a hot planet with a mag field generated by liquid motion in the mantle. Then, as the planet cools, the solid part gets larger and the material added is magnetized by the existing magnetic field. When the planet is completely solid, it has a leftover magnetization just like an iron bar magnet does.
IANA geophysicist, but this seems reasonable.