Java (JDK), 126 bytes
n->{int s=1,H[][]=new int[n+=Math.pow(3,n)-n][n],x;for(;s<n;s*=3)for(x=n*n;x-->0;)H[x/n][x%n]|=~(x/n/s%3)&x%n/s%3&1;return H;} Returns an int[][] with 0 for H and 1 for space. This actually "carves" a wall of H's instead of "piling" H's.
Explanations
n->{ // An int to int[][] lambda function n+=Mathint s=1, // size of the carvings. H[][]=new int[n+=Math.pow(3,n)-n;n][n], // change n to 3^n, through +=...-n to avoid an explicit cast int s=1, // size of the carvings. H[][]=new int[n][n], // and create the 2D array to return, filled with 0s x; // counter for the 2D array for(;s<n;s*=3) // for each size for(x=n*n;x-->0;) // for each cell H[x/n][x%n] |= // assign 1 to a cell of the array if... ~(x/n/s%3) // it is located in the "holes" of the H &x%n/s%3 // &1; // return H; // return the array } // end the lambda Credits
- -9 bytes thanks to ceilingcat.