If it's the flexing of the PCB that causes it ... it's almost certainly a mediocre soldering job that's at fault.
...don't type so hard ...?
From what I've generally heard and seen, when the board becomes unresponsive but can be revitalized by un,re -plugging, the I/O expander gets blamed. You might try taking a heat gun and reflowing your joints on the MCP23018 ... might give you a bit more leeway on the flexing issue, although by and large we wouldn't expect a PCB to put up with actual flexing anyway, so this might just get called a non-issue over the course of time.