[...]
Modifying the library code itself excludes that exception, leaving
the rest of the license to apply in whole.
I'm uncertain. The exception says, "If you modify this library, you
may extend this exception to your version of the library, but you
are not obligated to do so."
But that doesn't mean that the exception applies to modifications of
the library. The exception exists to allow consumers of the library
to use the library without falling under the other requirements of
the license, if _all_ they are doing is linking to it.
The above text simply means that if you do modify the library, while
you yourself aren't subject to the terms of the exception, you are
_permitted_ to provide the same exception to other consumers of your
modified version. That is, if _those_ consumers don't modify the
library itself, they may use the library via linking without
complying with the other aspects of the license.
Note that you're not even _required_ to extend the exception to
consumers of your modified version. It's simply allowing you to do
so.
But in any case, the exception doesn't apply if you're modifying the
code. It's applicable only in the scenario where all you do is
link.
If I modify the library and extend the exception, I
am obligated to disclose the modification, but I can still rely on
the (extended) exception to link independent code that may remain
proprietary.
All true. But the OP doesn't appear to be asking about code
independent of the library covered under the license. It appears
that he is specifically concerned with reuse via compilation of code
in the library. I would say that constitutes a modification of the
code, and thus the exception for linking doesn't apply.