Failed to restart sshd.service: unit network.service not found

The sshd.service file should have:

After=network.target sshd-keygen.target

if yours says network.service then it is wrong - so either something has edited this sshd.service file, or someone else has edited it. And this is the same on both Rocky 8 and 9.