Dnf mark group doesn't make package part of a group

I tried it on a Live USB and it works as expected:

$ sudo dnf mark group flatpak
$ sudo dnf remove fedora-flathub-remote gnome-software
$ sudo dnf remove @container-management
# See flatpak in the remove list.

I think what happened was that I used sudo dnf group mark remove container-management before, which irrecoverably made those packages orphaned.

$ sudo dnf group mark remove container-management
$ sudo dnf group install container-management
$ sudo dnf group remove container-management
# Nothing in the list!
# Try everything, but it will never work again...

EDIT:
sudo dnf group install container-management --with-optional can fix it, but will need to install all optional packages.