Composer keeps overwriting .htaccess (and other files) every time I do anything
That's Drupal's Composer Scaffold. Listed as "drupal/core-composer-scaffold": "^8.8.0" or a different version in your project's composer.json file.

To prevent certain scaffold files from being overwritten every time you run a Composer command you need to specify them one by one in the "extra" section of your project's composer.json. See the docs on Excluding scaffold files.

The following snippet prevents the .htaccess and the development.services.yml from being overwritten.

"drupal-scaffold": {
    "locations": {
        "web-root": "web/"
    },
    "file-mapping": {
        "[web-root]/.htaccess": false,
        "[web-root]/sites/development.services.yml": false
    }
},




But maybe you want to ensure you always get Drupal's latest .htaccess for security updates for example. For that you don't exclude this file from Drupal Scaffold but you patch it instead. See the docs on Altering scaffold files.

Create a patch of the .htaccess and maybe put it in a folder called "patches" in your project root. Then configure a "post-drupal-scaffold-cmd" in the "scripts" section of your composer.json file to have this patch applied to Drupal's core .htaccess every time Drupal scaffolding is triggered.

"scripts": {
    ...
    "post-drupal-scaffold-cmd": [
        "cd web &amp;&amp; patch -p1 &lt; ../patches/htaccess-ssl.patch"
    ]
}