When you remove a package with the command
yum remove PKG_NAME
yum will remove all other packages that are dependent on the package you are removing.
To remove a package without removing its dependency on Red Hat Linux or RHEL based distributions like CentOS, AlmaLinux, Rocky Linux or Oracle Linux, you can run the command
rpm -e --nodeps PKG_NAME
If you want to keep files, just remove the entry, use
rpm -e --nodeps --justdb PKG_NAME
Back to rpm