Here's a simpler, related question. Suppose you want to generate a number between 1 and 8, inclusive, and you have a pair of six-sided dice. What happens if you try to generate such a random number by rolling the pair of dice, taking the result mod eight, and then adding one? That is, what happens if you do something like the following?
int value = (rand6() + rand6()) % 8 + 1;
This will generate a random number in the right range, but it won't generate them uniformly. Specifically, the probabilities of getting different totals on the dice rolls aren't uniform:
2: 1 / 36
3: 2 / 36
4: 3 / 36
5: 4 / 36
6: 5 / 36
7: 6 / 36
8: 5 / 36
9: 4 / 36
10: 3 / 36
11: 2 / 36
12: 1 / 36
Taking these numbers, modding them by eight, adding one, and grouping them together gives the following probabilities of generating each number between 1 and 8:
1: 5 / 36 (have to roll 8)
2: 4 / 36 (have to roll 9)
3: 4 / 36 (have to roll 2 or 10)
4: 4 / 36 (have to roll 3 or 11)
5: 4 / 36 (have to roll 4 or 12)
6: 4 / 36 (have to roll 5)
7: 5 / 36 (have to roll 6)
8: 6 / 36 (have to roll 7)
Notice that these probabilities aren't uniform; you're more likely to get a 1, 7, or 8 than anything else.
This example isn't exactly what you're proposing, but it's the same idea. Adding up multiple uniformly random values does not give you a uniform distribution over the range of their sum, so if you start with such a non-uniform distribution and use mods to try to squish it into a smaller range, you'll get back a distribution over that range, but not necessarily a uniform one.
The more complex formula - which is a type of rejection sampling, by the way - generates a uniformly-random number over some range (1 - 30) repeats this process until it gets something between 1 - 21. The values produced in that range are then guaranteed to be uniformly random, and since 21 is a multiple of 7, modding by 7 guarantees a uniformly-random value between 1 - 7.