Adding wp_ajax to a theme outside functions.php (on specific template page)

Just drop it in a plugin. Theme = view. Plugin = constructor. I keep most of my stuff in plugins. IMHO only stuff that belongs to the visual part should be in the Theme. And yes, you can do a simple require( plugin_dir_path( $file_name ) ); for subfiles.