There is no idea of "numbers of units in my formation" in the formation data - unless you want to loop through all units and count it every time you need to know...
Determining who is the commander etc is a
fun process of following pointers from formation data to leader data and unit data etc.
Most of that is from the original "squeeze a quart into a pint pot" design of the original code, which was struggling to fit 50 unit s a side into the memory of an old 286 class PC with 1MB RAM. (Remember that SP 2's PBEM replay needed the full massive 4MB extension that a 386 gave you way back, and playing with all that himem stuff etc.

- not all computers would have >1MB installed).
Basically, it is undo-able with the code base as it stands. Same as with a few other annoyances.
Andy