pg_dump -> import traject using "upsert" paradigm?
I'd simply restore the table in another schema and forge my upsert command to insert/update B data from A data.
If you're using the plain text format using pg_dump, you'll be able to change the search_path at the beginning of the file to create your new table on the new schema.
If you're using a custom format, you can either get the SQL format using pg_restore and change it or use the -l flag to get the list file and edit it accordingly.
Have a nice day