Why casting a sphere to a cube give cylinder+cube?
The image above shows a blue mesh with a sphere shape, hereafter the blue sphere.  It is symmetric about the 3 axis similar to a cube.  Note the red faces have a 3 face corner not a 4 face corner. Not a UV Sphere.  The mesh will work symmetrically along x, y, z axis with a cast cuboid modifier.

In the image in your original question concentric rings of the UV Sphere are placed along the z-axis.  Speaking about the default situation.  So the there is an asymmetry regarding the z-axis.  So the [cast] modifier mathematics amplifies this asymmetry.  You will get slightly better results if you subdivide your mesh again.

You can edit the blue sphere in [edit] mode and rotate 90 on the y axis.  The asymmetry deformation will be rotated as well.

Here is the same blue sphere shaped mesh with a cast modifier.  Note again the red faces which form a 3 face corner of a cube.



To create a NON-UV sphere shaped mesh.  Create a cube. In [edit] mode loop cut on with 7 or so divisions. Loop Cut on all three axis XYZ.  Menu Transform ..... Transform to Sphere.  

Yes, start with cube, transform to sphere shape, cast back to cuboid.

Additional Notes
Please welcome Carlo



Cast modifier basically projects the object vertices along their normals to the target shape's surface. It is the same thing you would get by using a Shrinkwrap modifier pointing to a scene object.




By enabling Vertex normals in Edit mode, you can see on what surface each vertex will be translated to.







There is no vertex pointing toward the box's corner.



Conclusions:
To better approximate a cube, the starting sphere should have enough vertex density whose vertex normals point to the cube edges and corners. So for better results you can:


Increase the number of vertices
Use a different starting topology