No need drupal-scaffold, put .gitignore file inside folder project_template directly will work. The gitignore file can copy from https://github.com/acquia/drupal-cms-project/blob/main/.gitignore
Since Drupal core already scaffolds a .gitignore into place, I think we should simply append our stuff to it => I think drupal core does not have .gitignore file for the project. So if we use drupal-scaffold, we still need to create a .gitignore file to map => easy to put it directly inside the folder
To test this, we can use composer
composer create-project --prefer-dist drupal/cms="@dev" project_template_test --repository '{"type": "path", "url": "/var/www/html/project_template", "options": {"symlink": false}}'