The very reason for creating a test set is to simulate the real-world situation where you have to use your model on unseen data. This unseen data can have properties very different from the data that you trained you model on, including the distribution.
However, I failed to see how balancing the test set will cause us to leak knowledge about the test set into the training set.
It will not lead to data leakage since you are not using the data points in your test set to transform your training set, or to train the model itself. But it will also not lead to generalized performance. Your model would be specific to the evaluation you made on the altered test set.
Essentially, all I am doing is to check the number of samples in each class, and tossing away of excess samples that causes imbalance.
In this case, you are altering the property of the test set. The test set is supposed to act as if it was unseen data. By doing this, even though you might end up getting good test metrics (in theory), it will only give you false assurance that your model is working as it should (in practice).
Example:
You developed a model and evaluated it after discarding the excess samples causing the imbalance. You end up getting a test accuracy of 95%. You deploy the model today.
A month later when you re-evaluate your model performance, you discover that the month-long data actually contained 80% data belonging to one class. And your deployed model was not evaluated for such a scenario.
And unfortunately, the client who relied on the deployed model for leads made wrong decisions based on it and incurred losses. He may have fared better with no certainty than the false certainty the model gave him.