Some Explanation
First you need to understand the purpose of functions.php in a theme. Functions.php is basically just a plugin file with out any name which if present is automatically loaded by Wordpress. Wordpress loads your current theme's function.php for wordpress front-end pages and as well as back-end (admin) pages.
There is no different between a plugin and functions.php except that plugins have name and they can be activated/de-activated irrespective of other plugins and themes. The funtions.php is attached with your current theme and if you switch to another theme Wordpress uses new theme's functions.php and not your old functions.php with custom modifications.
Theme updates also overwrite functions.php and there is not way to avoid it, even if you put your custom modifictions in separate code files and include it in your fucntions.php, you will have to add that include line after every update.
Generally the type of code that should go in functions.php:
- functions that are used in your theme's template files.
- theme options
- sidebars
- navigation menus
- post formats
- post thumbnails
- any code that is only related to the current theme.
As you want to retain your custom modifications even if you switch themes. Because child theme will not work in this case as you will switch the theme and the functions.php of the child theme will not be used.
The Solution
The only solution as recommended by @Otto is to create a plugin file. The approach you can take to create your site specific plugin is to create a folder with your sitename in 'wp-content/plugins' and create plugin files in it.
Why plugin files? and not single plugin file.
Group related site's functionality related to code in separate plugin files and don't forget to add the plugin header in all your plugin files so they are recognized by Wordpress as separate plugins. You will then have the ability to activate/de-activate different features/functionality of your site without breaking everything.