fcm make: build: fix cyclic dependency logic

It was failing to detect the cyclic dependency demonstrated by test 17 (derived from the code snippet provided by the user who reported the problem).

I have also derived a new test battery (test 16) from a test in the old test suite.