Hmm.
I don't much like this, but I agree that it's probably a more robust solution than the previous one. It still seems worryingly fragile though: I'm worried we'll hit edge cases, and, while I know nothing about conda-build, the comments on the commit imply that Josh has similar concerns.
Assuming we don't just want to use the bundled libraries (and that would also make me a bit uncomfortable, but not enough to make me seriously object), I wonder if a thorough solution would actually involve patching the package so that the CMake code uses NO_SYSTEM_ENVIRONMENT_PATH internally, hence avoiding any need to futz with the user's path. Seems like that might involve us carrying a non-trivial patch in our package, though, which is also ugly.
In short... I'm not confident that this is a good, long-term, robust solution. But I have no obviously better ideas, so I'm happy for you to go ahead and merge.
I think we have to bite the bullet and just stop mariadb from looking for an external libz and use the bundled version. I would guess this problem can hit on Linux as well.
ARGS+=('-DWITH_ZLIB=bundled')
An alternative is to sanitize the PATH before calling cmake.