In `paginate_links()`, ensure that query string args are propagated to the resulting paginated links.

Adds unit tests that use `DOMDocument` since `assertTag` is being deprecated - see #29545, [29746].

Props obenland, wonderboymusic.
Fixes #29636.

Built from https://develop.svn.wordpress.org/trunk@29780


git-svn-id: http://core.svn.wordpress.org/trunk@29552 1a063a9b-81f0-0310-95a4-ce76da25c4cd