You explained it pretty well, but to simplify things.
Usually when a package needs additional files the package manager (dnf, yum, etc) knows the dependencies required to work properly and if you do for example
dnf install example-package
it will also install any needed dependencies and the newly installed package will just work.
OTOH, if you are compiling the package from source it is almost certain that you need the package-devel installed so you have the needed header and source code files before the compile will complete successfully.
An example when other package-devel files are needed is installing/compiling kernel modules which requires the kernel-devel package as well as the module -src and -devel packages.
I use an NVIDIA video and to keep up to date with the drivers, each time the kernel is updated the video driver has to be updated to match. I have the akmod-nvidia package installed which will automatically recompile the nvidia driver with each kernel update but that requires the kernel-devel package to support the recompile.
Each package may have different requirements, but usually if you install from the official repo the package manager will handle everything for you.