Ensure build-time deps are installed when bottle installation fails

Fixes #22245.
Closes #24324.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>