It's not a problem with dnf or yum.
What it looks like happened is that you installed one version, then it got updated later by another transaction. So, you can no longer remove the older version.
Instead of doing a dnf history undo, just do a dnf remove.
Remove your kmahjongg package, delete the config file in ~/.config then reinstall kmahjongg.