You're right, an Apple account shouldn't be shared. That can lead to all kinds of trouble.
When you sign out of iCloud on a device, then nothing you do on that device will affect what's in iCloud.
But this is why we keep backups--just in case something goes wrong, and we push a wrong button. To back up your pictures you can just plug in an external drive, select the pictures, and use Share>Save to Files. Alternatively, you can backup to a computer:
Transfer photos and videos from your iPhone or iPad to your Mac or PC
If you haven't done one of those backups, then your remaining pictures continue to be in peril.
There's some stuff in here that addresses turning off iCloud Photos:
Understanding iCloud Photos - Apple Community