Apply -undefined dynamic_lookup to all Apple platforms (#6075) * Apply -undefined dynamic_lookup to all Apple platforms * style: pre-commit fixes --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>