Merge folders and subfolders in macOS
Open a Terminal, and use ditto:

ditto [source] [destination]


For example:

$ cd ~
$ mkdir A/
$ mkdir A/1
$ mkdir A/2
$ mkdir A/3
$ touch A/1/1.txt
$ touch A/2/2.txt
$ mkdir B
$ mkdir B/1
$ mkdir B/3
$ touch B/1/x.txt
$ touch B/3/z.txt
$ ditto A B
$ open .