Note: The bug summary is just an educated guess; I'm not absolutely sure about the reason for the observed behavior.
Consider this project:
The library will not get built, because the cpp dependency is missing. Assume that the app project will build fine without the library. Then, if you uncomment the cpp dependency in the library and build again, the library will now be built as expected, but the app product will not get rebuilt.
Full minimal project to reproduce is attached.