It is possible to link accounts via actions with some limitations it seems.
I used the management API to link 2 accounts from the Post-Login action and it seems to be working fine. The caveat is that it must link to the account being authenticated (the most recent) otherwise the account would no longer exist after linking. For me this causes the user to be redirected to the login page and although the login would work on the second time, it’s not really good experience.
As an improvement, data from the older account can be copied to the new account (logs, login_count, etc. will still be lost though but that’s acceptable for out use case).