I’d check that the login_redirect filter isn’t being used in your functions.php file. If a search for the ‘/foo/bar’ path in your theme doesn’t return any results, a plugin like Peter’s Login Redirect could be being used and would likely store the path in the database.