How to make this cube texture node programmatically
If you mean a procedural texture, here goes...
This tree is based on 2 node-groups:
A 'Hexagonal Grid', as discussed here:

Which produces a hexagonal grid of cells, each with their own UV coordinates, on the left, below:

And a 'Distance to Hexagon' group:

which takes the maximum of the shading-point's local X and its projection onto a diagonal edge, all reflected in X and Y. When put through a threshold, it produces the edges in the middle image, above. If you use the whole set-up twice, once offset by sqrt(3)/3 in Y, then you get the cube-illusion on the right.
For the hatching, the same cell-UV coordinates are used to place a Gradient &gt; Radial texture in each cell of one of the overlapping hex grids, and it is stepped off into thirds with a Snap node, into sections valued 0, 1/3, and 2/3. (Left, below).

The values in those regions can be used to rotate a thresholded Wave &gt; Bands texture, to produce the directional hatching (middle, above), and combined with the outlines to give the result (above right):
The whole tree is a bit big to show conveniently, sorry:

The result: