Mod_rewrite in .htaccess is being remove by Wordpress setup

I’m not sure if this is the correct place to post this.

I am using this as my yaml file.

When I do docker-compose up the .htaccess file has the mod_rewrite code but when I go through the WordPress set up it removes the .htaccess and just leaves this text:

# BEGIN WordPress
# The directives (lines) between `BEGIN WordPress` and `END WordPress` are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
# END WordPress

Any reason it might be doing this? It does not do this when I use MAMP to set up WordPress.

Thank you for any help.