UPDATE::
The Example in the Answer below works, But it may be from a result of some sort of BUG in Pages.
I did not save the test document when I did this until now.
It seems when you reopen the Document. It saves the result in the total cell of Table A, as text. i.e removes the formula.
So the REAL answer is NO. you cannot do this in Pages.
You CAN do what you want in Numbers
Original Answer
In the cell of Table (A) the table you want the sum; type a equals symbol. =
You will now get a the formula box.
(cell in table A)
Type SUM(headerTitle) in front of the = with no spaces.
(cell in table A)
The headerTitle being a Header Title from Table (B)'s Header Row or Header Column.
In this example I use Table B's Header Row title 'headRowTitle2'
(table B)
(The Row in table B will highlight to show the cells Table A will be using)
Click the green tick button. It should now display the total you want.
(table A)
You can create a symlink of the actual pages template directory on your Mac in your Dropbox so that you don't have to maintain two copies of your templates, and then use Dropbox to open the template files in Pages to make a new doc based on the template.
Though template files are saved as .template, Pages for iOS still opens them correctly. You can create the symlink with the following command:
ln -s ~/Library/Application\ Support/iWork/Pages/Templates/My\ Templates/ ~/Dropbox/Pages\ Templates
Best Answer
There are two approaches you can take.
OSA / AppleScript
Use macOS's Open Scripting Architecture (OSA) to interact with the Pages application.
Apple continue to support AppleScript within Pages. You may find this approach is enough, with iWork Automation's helpful examples.
Decompress, Edit, and Recompress
Alternatively, you can directly edit the Pages document using a custom script.
Pages documents used to be a compressed archive of XML and supporting files. More recent iWork documents (Pages, Numbers and Keynote) use iwa named files which are also documented but compressed versions of the data.
From the excellently documented open source project iWorkFileFormat comes this description:
If this sort of technical scripting is your idea, start by unzipping the file, apply your script to the resulting data files, and recompress.