The "new" External Credentials are not supported for 2GP packaging per the Metadata Coverage report:
https://developer.salesforce.com/docs/metadata-coverage/58
Legacy Named Credentials are generally inappropriate for Managed Package usage because they can be used by any code in the subscriber org. Said differently: If you're shipping a secret in your managed package, you should use a Protected Custom Metadata Type record. (This recommendation was provided by Salesforce Security Review Office Hours)
For secrets that vary from subscriber to subscriber and need to be provisioned into each org, that's where a Protected Custom Setting (and UI to allow the subscriber to set it) or providing them with laborious instructions for creating a Named Credential (new or legacy) may be appropriate.
A separate, but related, thread was created which suggests against using Named Credentials in managed packages due to their brittleness when it comes to being updatable in a subscriber org. The PM for Named Credentials (Ross Belmont) said:
The first blocker teams tend to face is the inability to include secret values in metadata; that will never be workable from a security
standpoint since metadata can be accessed in plain text XML. Something
would need to be done post-deploy to fill in the missing piece of
configuration. 🧐
Separately, we see that a surprisingly large percentage of the time,
the full details about a remote endpoint can’t be known at packaging
time. Sometimes, there’s a dynamic or custom subdomain, similar to how
we have My Domain in our platform. A variation of this same idea is
that the endpoint used in sandbox for testing is very often not the
same endpoint in production. (Remote systems can have their own
concept of sandbox or test environments.) These factors make adoption
of Named Credentials among our AppExchange ISVs in particular lower
than we’d like it to be. 😕
https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000JgiQmSAJ
Lastly, IIRC, you can't grant access to the "new" External Credentials via Permission Set -- it can only be granted by Profile which seems to be absolutely backward with regard to Salesforce's recommendation to stop using Profiles to provide access.