wp db search (and other wp db * commands) call @WP_CLI::get_runner()->load_wordpress(); because WP-CLI executes wp db * commands after wp-config.php has loaded but before the rest of WordPress has loaded: https://github.com/wp-cli/wp-cli/blob/d9d405a4ca01ba23e80277b8cb9000857e84e0cd/php/WP_CLI/Runner.php#L875
Calling @WP_CLI::get_runner()->load_wordpress(); to avoid redefinition of constants in wp-config.php is a hack. Instead, these commands should continue loading WordPress without loading wp-config.php again.
Related #15