AFAIK, TRIM is an OS level function that perform from time to time (assume hardware support it).
MacOS perform a manual TRIM during boot. This turn all remaining empty space on the SSD into over provision effectively. Therefore, the SSD should able to perform as expected right after boot to desktop.
However, this is not enough. If you rarely reboot the machine (most Mac user only use sleep indeed), then those TRIMed empty space will still run out eventually.
And the OS will actually TRIM the SSD from time to time. Ideally, this only perform when the system is idle.
I rarely monitor TRIM activity. But one of my net friend did that a few months back. What he found is that MacOS seems only perform TRIM once every few days.
I don’t know if his data is 100% correct. Or if that result only applicable for his SSD, or even his setup. But if that’s true, then if we don’t perform TRIM during boot, macOS should still TRIM the SSD later on, but may need to wait for few days. And in between, the SSD may not perform as expected.
Back to your situation. I don’t know if the system will be locked during TRIM. As I said, it seems that only happen once every few days, and most likely when the system is at idle. Therefore, the user may never notice when TRIM happen.
So, unless every time after lock up, you can find the TRIM record. Then we may safely assume that lock up is TRIM related. Otherwise, that may because something else.
On the other hand, I am not surprised if the system is locked when waiting for storage IO return, that sounds very normal to me indeed.
So, why this lock up only happen on some SSD but not others? I think that may depends on how the controller determine “idle”.
Assume the Samsung SSD controller is very conservative, and only report “idle” (or more precise, “ready for TRIM”) when the disk is at long idle. Then most likely the user is not using the computer, and won’t notice the lock up.
But if the WD controller reports idle more aggressively. Then it may active TRIM inadvertently, which causing a system lock up when the user actually still using the computer.
Anyway, all these are just a theory, I have no prove for that. But this theory fit what I know so far.