I had one dog that ate his own poo when he was young. The vet gave me a pill to give him that made his poo taste bad (imagine how it tasted good before) and he quickly stopped eating it and never did again.
We tried that pill when our GSD was a pup.. it didn’t work with him.
We then changed his diet to raw and quit letting him be alone with his poop, and we didn’t let him see us clean it up.
It was a pain, but he quit this gross activity within a few weeks and he hasn’t done it since. Now he goes out of his way to do his duties in the “tall grass”. ;>)