Blindly replacing #include <assert.h> to look up something incompatible that doesn't respect NDEBUG seems like a remarkably bad idea
There's a whole host of things that libraries need to be extremely conservative about touching. Assert, threads, signals, etc.
To my mind the extent of the contract is that if the user has set NDEBUG then you can assume that assert will be a noop. I don't think you as a library author can make any assumptions about what happens if you set the flag yourself.
There's no difference between the flag being set/unset by your build system, and #define-ing or #undef-ing the symbol in code