That would be “fun” to implement with hidden empty staves and/or condensing, because the number of bars in a system might depend on the staff size, and the number of staves might depend on the number of bars in the system…
Aside from that, I don’t think the typography would look nice if every page had a different “optimum” staff size. You would need to limit the sizes to a small number of choices somehow.
Doing it manually, I would probably work the other way round: find the staff size for the most crowded pages of the score, and then consider increasing the size for pages that look too “empty”. If the most crowded pages need a size that is too small to read, either you need a bigger paper size, a different strategy for condensing, or even split some staves onto separate pages (as in editions of Das Rheingold where the 6 harpists all need to see their individual parts, but a score reader doesn’t really care who plays which notes, since they are all playing “minimalist” continuous arpeggios of 16th notes based on the same chord).