Install Security updates via kickstart file offline during the OS from a bootable ISO error: Error: no package is available for update. Once the OS is installed, the same package works

We are trying to do a fresh install of Rocky 9.3 on a node. We have created our own kickstart file which is pointing to the latest security updates that we have packaged within the iso. We are doing this using the “Post install” part of the kickstart file
During this scenario, it exits with a “no package available for update”
But once the OS is successfully installed and I run the package again, the latest updates are successfully installed
command I am using in kickstart file:

%post --nochroot --log=/mnt/sysimage/root/ks-post.log
echo “Started the security updates”
cd /mnt/sysimage/nfsshare/Security/Packages || exit 1
yum -y update ./*.rpm --allowerasing --nobest
echo “Successfully installed the security updates”
%end