What you are describing is that switching between your account and your wife’s account sometimes returns you to the login screen, after which the iMac can become completely unresponsive and require a forced restart.
There is not enough information yet to identify the cause, and I would avoid assuming that the macOS update is responsible until we know more.
The fact that you previously received two suggestions, tried one, and found that it worked for a while is useful. If you remember what that suggestion was, or what you changed, please include it. That may help avoid repeating something you have already tried and may provide a useful clue.
It would also help to clarify exactly how you are changing users. If you are using Fast User Switching, please say so and indicate whether both accounts normally remain logged in. If you are instead logging out of one account and then logging into the other, please say that.
Please also describe what happens immediately before the freeze. In particular, does the login screen appear normally? Can you move the pointer, click, or type at that point? Does the problem occur every time you switch users or only occasionally? Does it happen when switching in both directions, or only when changing from one particular account to the other?
It would also be useful to know whether this started after updating to macOS 15.8.1, or whether it was already happening beforehand.
One useful diagnostic test, once we have clarified the above, would be to completely log out of one account before logging into the other rather than using Fast User Switching. If the problem does not occur when doing this, that would give us a useful clue about the circumstances in which the freeze occurs.
For now, I would avoid making further substantial system changes until these details are established.
Please also provide the exact iMac model/year and processor shown in > About This Mac. “21.5-inch iMac” by itself is not enough to identify the particular hardware configuration.
Apple's explanation of Fast User Switching may also help you identify which method you are using: Apple Support: Fast User Switching.
If the iMac becomes completely unresponsive again, Apple documents holding the power button until the Mac shuts down when it cannot be restarted normally. This can result in the loss of unsaved work: Apple Support: If your Mac doesn't respond.
The details about the previous fix, exactly how you are switching users, what remains responsive when the problem occurs, how often it happens, and when it began should give us a much better starting point without assuming a cause.