It's a hacky solution, it relies on the order in which modifiers are evaluated, and it produces an error for the first vertex...
Name your Cube Main. ShiftD duplicate it. Hide Main and name the copy Instancer. Tab and in Edit Mode select everything if it's not selected already, X Delete, O Only Edges and Faces. Add a vertex group and assign all vertices to it. Tab in Object Mode add Build modifier, set its length to the number of vertices (8 for a cube) and set scene's frame end to the same number.
AltD to make a linked copy of the Instancer. Name the copy Mask and hide it. Select the Instancer again, set Build's modifier starting frame to 0. Add Vertex Weight Proximity modifier, set the vertex group, the target to Mask and Proximity Mode to Geometry. Add Mask modifier and set the vertex group.
In Object Properties > Instancing choose Vertices. Create a UV Sphere and parent it to the Instancer. Hide the Instancer and unhide Main. In the outliner, disable rendering of all currently hidden objects.
One corner is being missed... A workaround: select Instancer Tab for Edit Mode, AA to deselect all, CtrlRight Click to create a new vertex, menu Mesh > Sort Elements > Selected to put it in front, also increase the Build modifiers lengths by 1 (to 9 in case of the cube) and decrease their start by 1 (to -1 and 0).
Replacing with a more complex object is surprisingly easy: delete Main, insert the new object (I added Suzanne), select Instancer, in Object Data Properties switch the mesh to the new Main's mesh, make a single-user copy, remove edges and faces, add a vertex, move it in front, use statistics to count vertices, update the Build Modifiers length and scene.frame_end, change Mask's mesh to the same the Instancer uses. Done.