"Your text box solution would not be appropriate where line numbers are continuous across page boundaries."
Not "my" solution. It was offered by bjh333
The extension to multi-page docs could be accomplished with a separate box for each page.
Generating the number list can be done in Numbers by those hesitant to open and use Terminal. If the number of line on a page is known, the Numbers table could be set up to contain the list of numbers for a page in a single column, with as many columns as needed for the maximum number of pages expected to be needed.
Copied from Numbers, the paste into a text box would be via Edit > Paste and Match Style (after setting line spacing, font attributes, and justification).
Regards,
Barry