I just noticed something curious. I just upgraded my workstation to Rocky Linux 9 with KDE from EPEL. I replaced the buggy SDDM login manager with GDM, and things look quite OK now.
Now here’s the thing. Let’s say I add my user to a system group like this:
# usermod -aG mock kikinovak
Normally it’s enough to log out and log back in for that to take effect. Curiously enough, it’s not. When I log back in and invoke groups as my user, the mock group doesn’t appear in the list of secondary groups.
On the other hand, it works after a system reboot.
At a guess, I’m hedging my bets on a systemd user process still active on the system after you logged out. Could well be it requires more time after logout before this process dies/closes gracefully or it isn’t doing so for some reason.
Our GDM/Gnome/X11 sessions tend to leave a process (cannot remember what) behind and stay in “closing” state forever. Those users have not had issue to see new group memberships though.
It doesn’t seem like a good idea to have to reboot a system to join users to groups.
It should be possible to do it on the fly, there must be some reason but I don’t know.
Did you check loginctl to see if a session still existed after logout? If you did, you could find out what was still running and kill it to close the session without restarting. Or potentially use a systemd command to close that session down. Or, as @jlehtone said check if sssd is installed on your system in case this is the problem.