This metric makes little sense for this use case. Consider two countries. They are identical in every way except in Country A 90% of the companies are publicly-traded while in Country B 10% are. Country A will have a market cap to GDP 9x Country B's. Does that mean Country A is 9 times overvalued relative to Country B?
The objection works in-country, too. Saudi Aramco is going public in New York or London [1]. This will lift one of those market's aggregate capitalisation by up to $1 trillion. Does this mean that market will necessarily become overpriced?
The answer to both question is of course not. Market cap to GDP tells you the degree to which a country has developed public markets. Not anything interesting about the levels in those markets.
[1] https://www.bloomberg.com/view/articles/2017-04-05/aramco-ip...