Hello Sh1tattecme,
It looks like the contacts are synced only with your Yahoo account and when you remove the account, the contacts are also removed. This is expected.
If you prefer, try setting up iCloud Contacts instead so you can have your contacts on all of your Apple devices. To learn more and to get this set up, use the details below:
When you turn on iCloud Contacts, all of the information* stored on separate devices uploads to iCloud. If you turn off iCloud Contacts, your information won't automatically move from iCloud back to your device.
"On your iPhone, iPad, or iPod touch
- Go to Settings > [your name] > iCloud.
- Turn on Contacts.
- When you're asked if you want to Merge or Cancel, tap Merge.
All of the information stored in Contacts uploads to iCloud."
Set up and use iCloud Contacts - Apple Support
All the best.