Locally on an iPhone when an app is deleted off the phone, the data it contains still remains - somewhere.
I’ve deleted apps off my iPhone that contained my data files and login info, then downloaded them again a few days later only to find all my data files and login info populated the app as if I never deleted it.
This was locally stored data not in iCloud.
Data in iCloud might follow the same bad behavior.