Is it be possible during setup to dynamically discover the number of available port expander chips (with an I2C scan from 0x20) then define a corresponding input array which could be available to the rest of the sketch?
Don't think so. All you can do is define an array that will be at least as big as you think you might need.
Thought that might be the case.
Wouldn't just be one 17 entry array per chip, would need at least four arrays, and can't be declaring 8 chips worth when I might only need 1 or 2, so I guess thats the end of that idea.