Canals can act as a buffer in case of heavy rainfall. This requires the canals not to be connected to open water. In anticipation of heavy rainfall you would pump water out of the canals, into open water (sea). The canals can then act as a temporary buffer for excess rainwater. True, this wouldn't help against dike-breaks.
Related to this: in Holland there are many farmlands in the proximity of rivers that are designated as buffers like these. When necessary, they let these farmlands run full of water in a controlled way to prevent downriver cities from flooding.