Richmond Castle, very close to where I live is built on the highest ground, one side is a sheer cliff with the RiverSwale below. The bridges to cross the Swale are on much lower ground either side of the town, both are made from stone, both have been there since the castle was built in the 11th century. Damming the Swale would be more than tricky, building bridges would be difficult enough, the Romans when they were here didn't try, it's the fastest flowing river in the UK, with plenty of white water.
The castle hasn't been attacked in its history but if it had flooding would never have been an option.
Not terribly surprising, that's a good description of where a LOT of castles were built. For reasons that should be obvious, don't you think?