How to use the array modifier multiple times in an optimised way?
You could do this using arrays, because they can be given Start and End Caps which can, themselves, be arrays. But you would be creating a lot of work for yourself.

when you put a second Array modifier on an object, it doesn't override the previous parameters; it generates an array with the entire previous array as its elements.

You might be better off using a different duplication method - perhaps Vertex Instancing:



.. using a simple framework of vertices. Every time you E(XY or Z) extrude a new vertex, a cube will be instanced on it.