Re-assign $db after beforeSave.

This allows model/behavior methods to change the datasource in the
beforeSave callback. If you use drivers from different SQL platforms
things will go very poorly.

Fixes #3606