There's no way you can do that.
The numbers on the thumbnails are assigned automatically for any view or filter, and always start with 1.
If you could further explain why you need this capability then maybe someone could offer a different workflow to accomplish the task you are trying to do.
Press 'J' to toggle the info shown on the thumbnail borders through its 3 formats.
The large 'faded' 1,2,3 is one of those format options- a temporary sequential numbering of the visible photos, it is not a permanent Lightroom Picture number.
So the answer is- you cannot keep them!
You can change the 'detail' option of info-
Click the mouse on one of the four positions to change the info shown-
But you still will not see the 16, 20, 50 that was temporary in the full grid view without the flagged filter, even if you set this info to "Index Number" as in this menu shown- "Index Number" will continue to show 1,2,3,,,.
Don't know if this helps, but you can select all flagged photos by pressing Ctrl+Alt+A (Cmd+Optiion+A).
There are several options for selections in the Edit menu.