It seems you’re doing things wrong. The ownCloud’s data directory must be treated as a blackbox: nobody touch it outside of ownCloud and nobody cares about its structure. Modifying files there is NOT supported.
External storages are the ones that allow this behaviour. You can change files inside external storages as it is planned.
The occ files:scan
command is there mainly to fix stuff. If you need to run it on regular basis, you’re doing it wrong.
I’d recommend you to go back to square one and re-think what you want to acomplish. Trying to fix something that you’re breaking on purpose (maybe because you didn’t know, ok) isn’t the way to go.