...but it's also okay to say
How many pieces of gravel do you have now?
Yes and no. You wouldn't say that to someone who just had a load of gravel delivered, you'd stick to "how much gravel" (and they'd probably reply with X number of tons or loads or bags or similar); "how many pieces" would be unanswerable. But if you were asking about the number of pieces of gravel someone had in their hand, for instance, it would be fine.
Then, how about garlic, which is another uncountable noun? I know I can say two cloves of garlic, but what should I say if it's a whole piece of garlic?
The "whole piece" of garlic is called a "head" or "bulb," so you'd use one of those terms instead of "piece," which could be ambiguous.
This will be situation-dependent. If you're going the shopping and are asking how much garlic someone wants you to buy, you'd ask "how much" or "how many heads/bulbs" because you're not going to closely examine each head as you buy it to try to figure out how many cloves it has in it. But if you're helping someone cook and they ask you to peel the garlic for the recipe, you'd probably ask "how much" or "how many cloves" they want you to peel (and even if you ask "how much," they'll likely answer in cloves).