Chinese five spice has an origin as being a bit of use all spice blend. One which hits all five of the areas for taste that we humans have. Bitter, Sweet, Sour, Savory (umami) and salty. There is no one specific blend and it has been adapted as it moves through Asia over the decades.
The active ingredient in chili pepper is called capsaicin and it will interact with the taste buds of most mammals to create a burning sensation. No permanent damage is occurring, however it can feel pretty intense at the time. We all have different tolerance levels to this active ingredient.
Sometimes following a recipe to the letter can still mean an overly strong flavor of ginger due to variations in fresh ingredients. To save a recipe from this problem you can remove the ginger, dilute the dish, cook for a little longer or add additional ingredients to take the bitterness away.
Adding too much garlic is possible but there is a difference between a recipe that calls for 40 cloves roasted and one that needs a teaspoon of garlic powder. The strength of the garlic taste depends upon how it is cooked; roasted it is sweet but raw it holds the pungency we all love in moderation.
The best way to solve the problem of adding too much rosemary to cooking is to remove it as soon as you realize your mistake. Or you can dilute it with adding more of other flavors. Alternatively you can dilute by doubling your portions, or adding tomatoes or even dairy products like sour cream.
By categorizing the flavor profiles of herbs and spices it is easier to understand how they may match one another, or more importantly how they may compete and overpower other flavors. You do not want to waste delicate flavors of saffron by pairing with fresh ginger, for example.