(#23074) Fix cert inventory race condition

This fixes a race condition in cert inventory rebuild by making reinventory a new subcommand of the
puppet cert application. Appends to the inventory.txt are now atomic writes in append mode.

This also refactors the interaction betwen the cert application, CertificateAuthority and its Interface class.