Thanks @Grantler and @ajlittoz . Now that I understand it, I have tried using a bookmark, which seems a bit more natural than a cross reference, and has a small advantage that the bookmark is visible as a light grey character that looks like a capital “I” like this:
Please correct me if the cross-reference has some advantage. That is, for the bookmark solution I do the following:
First I create separate sections with “Insert > More Breaks > Manual Break > Page Break”, choose the page style of the next section I want, and check “Change Page Number” and set it to 1.
Then I go to the end of the document and choose “Insert > Bookmark”, and name the bookmark “LastPage”. I turn on “View > Field Shadings” or “ctrl-F8” and it shows up as a grey capital “I”.
Then I go to the Y position in “Page X/Y” in the footer of the main body, and choose “Insert > Cross Reference” and choose “Type=Bookmarks”, “Refer Using=Page number(unstyled)”, highlighted the bookmark “LastPage”, and clicked “Insert”. The page number shows up as the number of pages in the main body of the document.
I’m not sure if it will always be true, but I also noticed that with a bookmark the page number updates automatically when a new page is added to the main body - so far I have not had to select the whole document and do an “F9” to update the fields.
Does this all seem ok to you?