In versions of Safari going back at least a year, when the Develop menu is on, all cookies are expired hours after being set. I'm using Version 16.1 (18614.2.3.1.1) currently.
I had the problem for a long time before discovering the cause (in a MacRumours forum post).
I’d rather not have to keep using Chrome for development work, but that's what I have to do until this issue is resolved. Does anyone know of a workaround or at least whether the problem has been acknowledged?