There are various tools which can be used to download the rpm along with it's dependencies (and not install them) other than yumdownloader such as repotrack.
# repotrack glibc
You can also use repoquery in combination with yumdownloader to identify the list of dependencies and download the same without installing.
# yumdownloader --downloadonly --downloaddir=. glibc --resolve
Here the tool will download glibc rpm along with the dependency list
Make sure yum-utils is installed on your setup to be able to use these tools.
# yum install -y yum-utils
NOTE: In all such commands and tools which gives you the list of dependencies, one thing is missed by most individual. This tool will check the localhost for the list of missing dependencies and will download the same but if you plan to take this dependency list to a different host which has a different set of rpms installed or even worse if a different minor/major version of same OS is installed then it is very much possible that the downloaded dependency list installation may fail.
So it is recommended that if you plan to create an offline repository for some client host then the source host used to download the rpms must have same set of rpms installed as the client host.
How to download rpm package and all dependencies
You can also synch the online repository on your local machine https://www.golinuxcloud.com/how-to-download-entire-repository-from-centos-rhel-7-for-offline-use/
and then use it offline for later purpose.
# reposync --gpgcheck -l --repoid=extras --download_path=/tmp
Synching an entire repo will take alot of time depending upon the rpm count.