Here are a range of PDF-manipulating command line tools that can be installed directly:

**XPDF tools**  
https://www.xpdfreader.com/download.html

**PDFtk Server:**  
https://www.pdflabs.com/tools/pdftk-server/

**Coherent PDF tools**   
https://www.coherentpdf.com/usage-examples.html


**GhostScript**  
You can of  course use [GhostScript][1] to merge PDFs.  
Binaries for Mac are here:
https://pages.uoregon.edu/koch/

If you're into python, there are various python libraries that will manipulate PDFs, such as pikePDF.
https://github.com/pikepdf/pikepdf 

You could create a workflow using Automator.app or Shortcuts.app, and call it from the CLI, using the `shortcuts` or `automator` commands.

I've also written a suite of python scripts that call macOS APIs to perform various PDF functions:
https://github.com/benwiggy/PDFsuite  
(You'll need to install the pyobjc library.)


  [1]: https://www.ghostscript.com