This problem really interferes with my work. And it's frustrating to have Search engines come up with the same, "...set it in preferences..." recommendations. "Doesn't Work" is not "How it's supposed to work".
My work-around is, right after launch, immediately go to the History menu and select "Reopen all windows from Last Session" - about the seventh option down.
The fact that Safari KNOWS which windows/tabs were open - because after that selection they are opened - points to it just ignoring the preference. I mean if I can click on a menu option and have the desired action taken - the action that is specified in preferences - then on launch they just need to check if the Open from last session preference is checked and trigger the same action that is tied to that History Menu selection.
I suppose, if you had a Quickkeys type app, you could make a keying sequence that would launch Safari and continue to click History, then "Reopen All Windows from Last Session."
I'm an old guy. Started with a 7094. When I see the code the younger generation is putting out, I have no fear of AI taking over the world.