The megaraid_sas driver package for Red Hat Enterprise Linux (RHEL) / Rocky Linux is provided by ElRepo. However, as of the time of this writing, the precompiled package for EL 8.7 doesn't exist for some reason.

To build this package, run the following (I did this inside a Rocky Linux 8.7 Docker image):

# yum -y install rpm-build elfutils-libelf-devel kernel-abi-whitelists kernel-rpm-macros make gcc
# wget http://dfw.mirror.rackspace.com/elrepo/elrepo/el8/SRPMS/kmod-megaraid_sas-07.719.03.00-1.el8_6.elrepo.src.rpm
# rpm -ivh kmod-megaraid_sas-07.719.03.00-1.el8_6.elrepo.src.rpm
# rpmbuild --define "kmod_kernel_version 4.18.0-425.10.1.el8_7" --define "_topdir $HOME/rpmbuild" -bb /root/rpmbuild/SPECS/megaraid_sas-kmod.spec
# ls /root/rpmbuild/RPMS/x86_64/kmod-megaraid_sas-07.719.03.00-1.el8.x86_64.rpm

Replace the kernel version with the kernel version you're targetting. In my case, it's 4.18.0-425.10.1.el8_7.