fix: keep earlier exception translators ahead of local fallbacks (#6255)

* fix: keep earlier exception translators ahead of local fallbacks

On non-libstdc++ platforms, each module that fetches existing internals
adds its translate_local_exception fallback. It was added at the front of
the global list, so it handled builtin_exception and std::exception
subclasses before translators that other modules had registered earlier.
Importing any pybind11 module after such a module broke its translations.

Insert the fallback ahead of the default translator at the end instead.

Assisted-by: ClaudeCode:claude-opus-5-5

* test: preserve FreeBSD xfail for later-import translator test

— codex on behalf of Ralf —

The new subprocess regression repeats the shared_exception translation
already marked as an expected failure on FreeBSD. PR #5925 documents an
RTTI mismatch between extension modules loaded with RTLD_LOCAL there.

The translator-order fix does not change that type matching. Preserve the
FreeBSD expectation in the new test so the known platform limitation does
not become a hard suite failure. Retain raises=RuntimeError because the
subprocess helper wraps child-process failures in RuntimeError.

Validation: prek -a --quiet; incremental GCC/C++20 builds with CPython
3.14.4 default and free-threaded. Pytest: 1458/1456 passed, 14/16 skipped;
Catch2: 31 cases and 1709 assertions passed in each environment. Native
FreeBSD was not available for validation.

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
2 files changed