Forcefully add files in `Pkg.generate`

Makes the generation more robust and avoids potential clashes with any
global `.gitignore`.

ref: #9193
(cherry picked from commit 847c134f8667b8637d4d8ccf5dd8eb6f74288a4e)