Best way to power a circuit from an unknown number of battery cells?
It sounds like your best choice might be to replace the LDO with a buck (step down) dc/dc converter. Choose one that operates over a range that includes the minimum voltage you get from 2 cells in series (6V?) and the maximum voltage you get from 8 cells in series (33.6V?). Run the converter with the entire string of cells in series.

Be aware that the current drawn from the cells will be inversely proportional to number of cells in series.