If you were to migrate to Ory, you would not receive the OIDC token anymore though (unless you want to keep that part and use OAuth2). Either way what you get is the Ory Identity including
metadata where you can store the "old" sub during migration. In the OAuth2 case you would just add this metadata as a separate claim in the token, or look up the identity by ID (will be in the sub claim).
We always recommend to not use OAuth2 for first-party cases.