The docs at https://developer.wordpress.org/cli/commands/core/is-installed/#examples show an example like this:
# Bash script for checking whether WordPress is installed or not
if ! $(wp core is-installed); then
wp core install
fi
But that if is not right. It's testing whether the stdout of the wp core is-installed command is true or false.
The fix is simple, just remove the command substitution, like:
if ! wp core is-installed; then
wp core install
fi