Is there any better solution to protecting tabs from being lost? I have on a number of occasions recently lost a lot of tabs on my iPad. I have accidentally pressed the “close all tabs” button and I once had a frozen Safari window which I without foresight swiped to close and then realized I couldn’t just reopen. There is that trick where you hold down your finger on the new tab button to see some recently closed tabs, but it’s not sufficient - it didn’t record the closed tabs of my entire closed window, and it has a limited number of recent tabs, so if you close 500, you can’t get them all back. Going through your history is not much of a solution, as there’s too much to scour through.
Closed windows and tabs should be effortlessly retrievable, in my opinion.
Is there any clear solution to this? Is there a browser extension, perhaps?
This answer isn't meant to be flippant or disparaging in any way.  The purpose here is to present a critical evaluation exercise to evaluate the scenario from a wider perspective. 

Closed windows and tabs should be effortlessly retrievable, in my opinion. Is there any clear solution to this? Is there a browser extension, perhaps?

Emphasis mine.
There's no problem to solve
There's no solution because there's no problem to be solved.  As far as a browser extension goes, I'm assuming you searched but couldn't find one.  Let's examine why....
As you state, it's your opinion that closed windows and tabs should be &quot;effortlessly retrievable.&quot; I'm sure there are many people who agree with you.  However, there are many who believe the opposite, that a closed window should be closed and the data irretrievable (i.e. for privacy and security reasons).  So, given that there are two entirely conflicting positions, where does the developer land?
Exactly where it is now.
Existing functionality
Why?  Because there are existing remedies to dealing with accidentally closed windows:

There is the &quot;trick&quot; that allows you to see some of the recently closed tabs
Your browsing history is available

Nothing is without limitations
As you state, &quot;it's not sufficient.&quot;  Unfortunately, no application on your iPad (or any device for that matter) is without a constraint.  You mentioned &quot;500 windows,&quot; if Apple were to &quot;solve&quot; this tomorrow, you'd have someone complaining that it's not 600.  &quot;Going through your history isn't much of a solution because you have so much to scour through&quot; is not a failure or shortcoming of the app.

Solution: Structure your workflow in line with the tool

...it didn’t record the closed tabs of my entire closed window...

Why would it?  It already tracks your browsing history.  This expectation is outside the functionality of every other app and how they manage windows.  If they record or remember anything, it's usually the file or workspace you recently had open, but that's what history is.
If you have that many windows open (and I'm assuming they're all important), it's up to you to record what you deem necessary to remember.  I too, have many windows open however, when something is important, I take an active step to ensure that the window I'm on somehow gets recorded for posterity; and Apple gives you a way to do this: the Share function.

There are so many destinations you can send your page to:

Contact as a message or email,
AirDrop it to another device
Copy the link
Add a bookmark
add to your reading list
print it
Send it to Notes, OneNote, Evernote, etc.  I use OneNote extensively and if there's a tab I want to keep it get's sent to OneNote.

This requires you to make a small change in your workflow - if you see something important, make a note of it.  You won't have to scour history, you eliminate the imposed limitations of Safari and it will be flexible enough that you decide what should be retained and what shouldn't.
The bottom line is not to be too quick to perceive a fault or failure of an application because it doesn't meet a standard you've defined for yourself.  Many times, the &quot;solution to the problem&quot; is actually there, but we need to take a step back to see it.  Sometimes it requires modifying our workflow rather than the software.