This is just a simple question, and I haven't thought all that well on it, but I think in terms of sci-fi and fantasy less tied to probable scenarios this could be quite possible.
Imagine a free-floating planet, one that is not tied to any particular solar system, and therefore floats around in space. Where did it come from? Nobody knows. The real question is how it could have originally formed. Could it have been created from the remnants of a star?
Of course, this could in theory be applied to planets restricted in movement by stars that they permanently orbit. However, is it possible that all the materials from a once-existing solar system were dragged together around its star to form a crust, leading to the formation of a giant planet?
The planet would probably follow the same structure as the terrestrial planets of our solar system, with a core surrounded by mantle and the crust. In order to form this hypothetical planet, it would have to be quite large to incorporate the materials of the old solar system's star as its core, as well as all the planets that orbited it. I don't know how the planets were dragged into the star (perhaps it has a large gravitational force due to its mass, or the planets' elliptical orbits drew them into the star's vicinity?)
So, I guess the question I want to ask you all is if and how a planet like this would and could form, and would it be possible at all?