how to throttle spawning "custom mobs"

I made a "custom mob" that's basically a ravager riding an allay with some functions for special functionality. I want this mob to spawn naturally underground in my custom dimension. I could setup spawning for a mob (lets say a zombie) and then run a ticking function to kill all zombies and replace them with my custom mob. but the mob count will quickly skyrocket because if I kill all the zombies then more will keep spawning because there's nothing in the mob cap. How can I throttle mob spawning so there's only a "decent amount" of my custom mob?
Continue to help post