Your post is nonsensical. Anything on the device is locally stored there. The only way to get it off is to erase it. That is the correct way to sell or give away a device - to erase it and remove it from Find My iPhone: Prepare your device to sell or give away
It's not magic. And just so you know, signing into iCloud is not in any way related to what Apps and functions you use. Apps and other purchased media belong to the iTunes & App Store, not iCloud.
iCloud related functions do automatically download to your device when you sign into iCloud - Contacts, Calendars, Reminders, Notes.
But Apps and Purchased media belong to the App Store, and if the act of signing out of it deleted your apps, that would be an issue, wouldn't it? Also, singing in a different Apple ID to the iTunes & App Store does not change anything on the device.
It is not an issue, there is no "fix". There are procedures for signing into and using an iOS device, and they all involve erasing the previous owner's (or user's) "stuff" from the device. Once the device has been erased, and removed from Find My iPhone, you set it up, and you can set it up from a backup which does have all of your Settings, data, and pointers to your purchases which then automatically download to the device as a part of the restore.
So, if you have a particular question about an issue you are having, please let us know what it is. But mistaking your lack of knowledge about how the iOS device works as an "issue" is simply not accurate.
GB