I'm kind of curious where you are seeing these filenames being erased. Are you using the Photos app? It's true that Photos changes the file names to unique identifiers for internal use, but it remembers the original file name in its database and shows that in the Info Window. As Yer_Man says, this stored filename can also be put in the Title field by a script. Or, usually I use the 3rd party app Photos Workbench($30) for dealing with titles. Unfortunately, titles don't show in iOS or iPadOS, but filenames do show in Photos' Info window in all devices.
Also, as Yer_Man says, if you are not synchronizing your Photos Library with other devices, then you may not want to use iCloud Photos, at all. iCloud is only a limited sort of backup, and Time Machine on an external drive is a much better choice. I use Time Machine daily, and I copy my Photos Library to another backup drive monthly.