WordPress keeps writing rewrite rules to .htaccess

I am not sure why this happens, but you can stop all write access to your .htaccess with a simple filter:

add_filter( 'flush_rewrite_rules_hard', '__return_false' );

Neither WordPress nor any plugins calling flush_rewrite_rules() will write something into the file now. Other methods to access and change the file will still work, for example insert_with_markers().