It's server based , the account is erased from server nothing to do with saved password in keychain access ( still you can find saved passwords in keychain access in case if they are forgotten ) see the articles Set up iCloud Keychain - Apple Support
View the information stored in a keychain on Mac - Apple Support
In case if you once again recover the account from server , and add the account in internet account after that can be subtracted from internet account .
AN OTP code appears on the desktop , you need trusted device and secondary mail address and its password that was added in the account , in this method the old iPhone was discontinued and sim was damaged , so OTP code was not appearing , so have to add new trusted number .
I never tried to recover those accounts ( it all depends how the account was erased ) , do gmail services keep the account ?
See the link https://support.google.com/accounts/answer/6236295?hl=en
https://support.google.com/accounts/answer/7299973
The Apple ID created with gmail account say example1@gmail.com was permanently deleted from the gmail server , and if the account was set up with secondary authentication , the administrator can’t sign with iCloud account.
Sign in with rescue mail address in gmail account ( enter the password ) , click on personal info .
Click on edit , and try to add a new trusted number .
And can't further move , the bell icon will shake and stop and if you click on send the code that will go to the old trusted number that is inactive .
Click on more ways to verify , it again prompted to enter rescue mail address and password , Scroll down and click on account recovery icon , then add a new trusted number and click on next , the trusted number will add , the trick was using the rescue mail address that was attached to the primary mail address .