I think you can use packages that are not dependencies, otherwise Requires.jl would not be possible.
I have not tested my specific approach yet, but I think I can
require a package that is not a dependency and risk having an exception if it is not present in the system. The idea here is that this require will only execute if the user explicitly orders it to use some solver, and all code that depends on such specific package will be just below the
require call. The method that uses the non-dependency package will not even be called if the user do not order the use of the specific solver.
This really does not work for this specific case, as what I want is to provide such solver selection and configuration as flags of a script I will be the main user, but other users/scientists may find useful too. The core functionality of my package uses the approach you describe (all model building methods take a model object as a parameter and do not meddle with the specific solver), but this non-core functionality is a command-line script that should be ready to use the solver the user wants with the most common parameters among the solvers without having the user to install all solvers for this. I use it to do my experiments, and it would be an easy way to other scientists reproduce my results. If they want to pass additional flags they can mess with the code.
I would also like to point that the
require method that takes just one parameter is not documented even if yet present in the code