Here's the problem.
So I'm wondering if there might be a different place to put custom scripts other than within the theme directory.
When you put anything in the theme directory and upgrade then yes, you will lose all your work every time. Sorry, but that's how the theme upgrade mechanism works.
If you wish to keep your files/changes/additional work then you have no choice: create and activate a child theme.
https://codex.wordpress.org/Child_Themes
Or you could implement your scripts in custom plugins. But the child theme is a much easier solution to work with. :D