OpenSCAD not rendering polyhedron
Usually when there's an overlap in two objects during a difference action, F6 render will resolve the problem. There's something more than that involved here, as reducing the height of the cube creates a non-manifold object from the difference. user R..'s answer has merit but is not going to solve the problem.
Isolating the cube from the code and exporting the result as an STL allows me to determine that the faces are generated in a manner preventing a proper difference action:

This image from meshmixer shows the faces have inverted normals. The order of the points are critical when describing a polyhedron. From the wiki page for OpenSCAD:

It is arbitrary which point you start with, but all faces must have
points ordered in the same direction . OpenSCAD prefers clockwise when
looking at each face from outside inward. The back is viewed from the
back, the bottom from the bottom, etc. Another way to remember this
ordering requirement is to use the right-hand rule. Using your
right-hand, stick your thumb up and curl your fingers as if giving the
thumbs-up sign, point your thumb into the face, and order the points
in the direction your fingers curl.

EDIT: I reversed some of the points, haphazardly and luckily picked the correct ones:
        faces = [
            [0, 1, 2], [2, 3, 0],     // bottom
            
            [4, 1, 0], [1, 4, 5],     // side A
            [5, 2, 1], [2, 5, 6],     // side B
            [6, 3, 2], [3, 6, 7],     // side C
            [7, 0, 3], [0, 7, 4],     // side D
            
            [8, 5, 4], [5,   8,  9], // slope A
            [9, 6, 5], [6,   9, 10], // slope B
            [10, 7, 6], [7,  10, 11], // slope C
            [11, 4, 7], [4,  11,  8], // slope D
            
            [10, 9, 8], [8, 11, 10]  // top