solver: fix potential install_if processing failure, fixes #8237
In discovery phase, there was logic to not process packages multiple times. However, that logic failed to account the package's depth and install_if state for the name being processed. This caused install_if processing failure in certain topologies of the dependency graph. Adds also a test case that should catch this issue reliably.
Showing with 77 additions and 46 deletions