Re: difference of 2 polyhedrons returns 2 planar shape - is this a bug?
It's because the faces of your polyhedron are inside out. If you view in 'Thrown Together' mode, and view each polyhedron individually, you'll see that they are mostly purple. This means the 'normal' of the face is pointing the wrong way. From https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Primitive_Solids#polyhedron :
"All faces must have points ordered in the same direction . OpenSCAD prefers clockwise when looking at each face from outside inwards. The back is viewed from the back, the bottom from the bottom, etc.."
So you just need to reorder each face in the 'faces' part of each polyhedron, to get the faces so the purple is 'inwards', and the yellow is outwards.