As often as it is needed. Annual for a lot of dogs and never for some. Combination of genetics, diet, and "chew drive."
We have a couple of dogs that come in that at 7+ have never needed a dental because they love chewing on bones and have great genes. We also have 7 month old puppies that somehow already have a fair amount of tartar on their brand-new permanent teeth.
Annual dentals are a lot of peoples default and can prevent a cracked tooth from going unnoticed for a long time.
FWIW, I haven't had to do a dental in ... 15 years? As long as I've been feeding grain-free ultra premium kibble. We even just did a growth removal on the 8 year old, and would have happily added a dental if the vet felt it worthwhile (might as well take advantage of the anesthesia) but her teeth are perfect. She's not even a chewer.
My cats have needed more care. I have done a cleaning on one corgi. Individual genetics seem to play a huge role. Your vet should be getting a good look in the mouth at the annual check up. Cats are often much harder to assessed awake. I have Snowshoe/Siamese kitties and they seem more prone. I try to get them done at least every other year, in part because once they're under I can then do a good oral assessment.
I think breed plays a role too. Often the toy breeds develop dental disease faster, and ones with off bites. Beards that can get entrapped in the mouth can also play a role in adding to dental disease.
I personally dont think grain free vs. raw vs. quality grain food plays a huge role. Bones can help,but it depends on how the dogs eat them.
My oldest dog (13 almost) is on a good quality food, whole grains (as she tolerates them just fine), and hasnt needed a dental ever. My terrier who ate a premade raw food before I adopted him had horrible teeth, but his beard would constantly get stuck in his mouth.