Enhanced trait_exists() shim