How do I make an individually scaling square set shader?
To get your squares to remain square, they must use the same evaluated brightness from the image across their extent, otherwise some parts of the squares will scale, or pass a threshold, differently from others. In other words, the image must be pixellated at the square-centers first.
(The illustrations below are not all shot at the same grid-scale)
Make a Grid .. This is just a different way from yours, no better..

It has 2 outputs: 'Cell UV' and 'Cell ID'

'Cell UV' maps each cell in XY, -1 to 1, with 0 at the cell center. 'Cell ID'  colours the whole cell with the original, piece-wide UV at the cell centers.
Sample the Image, or your procedural texture, at the cell-centers, using 'Cell ID'...

..for a  pixellated image. This image, on the left, has been gamma corrected and made negative for this particular, &quot;printer's&quot;, way of making a half-tone...

The Half-Tone Screen, on the right, above, is made by making a 'Distance from Cell Edge'from the cell UV:

Combine: When the screen is multiplied with the image, put through a threshold, (and inverted again,) using a Color-Ramp, you get a traditional black-dots-on white half-tone.

If you do without the negative steps, you get white dots on black.

This example samples only one point for each cell, at the cell center. You could, say, take samples from a number of well-arranged  points in each cell, and take their average, for more accurate toning.