did you know that sonarr can lower case folder/filenames as part of its media management settings?
the download client returns the filename to sonarr when the job is completed so for it to send the original filename and not the rename would mean that you either ran your rename process outside of that pipeline, or your rename process didnt update the download client with the new filename
if your download client cannot handle either of those then you have the option of doing it yourself. you can disable completed download handling in sonarr and then update your script to push it into sonarr (using the api) after its been renamed.
theres only so much sonarr can do when the underlying OS is case sensitive, so you need to either change the OS, or change the way you do things.