However, if there is a good reason why the result of a compile that
included a file from a work, which appears only in that work because
it is an extension unique to that work, is not derived from that work,
I'm interested to read it.

The most obvious one would be if the portion that occurs in the result
of the compile is not copyrightable because it is a list of facts, for
example. Or its expression merges with the idea.

Using grep on the command-line is a bit different. The use could have
been derived from a published description of it and I don't end up
including grep as part of the compile.

Then why aren't those published specifications a derivative work of
'grep'? [I know a few very good reasons, which apply in general not
just to grep. I'm just pointing out that this doesn't justify your
thesis.]

There are quite a few versions of grep, too.

There are quite a few versions of the X libraries as well. Especially
since they come from published standards.

I don't know libcurl enough to comment on it and I think that's
getting off-topic.