Fast way to determine the dimensionality of a statistical distribution

Anyone have ideas on the fastest way of getting the dimensions (number of coordinates) out of any Wolfram Language distribution. For some types (CategoricalDistributions) it is easy. And if a RandomVariate can be generated, it is easy too. But for symbolic distributions, one can’t generate a random variate. One can try to compute a Mean or possibly a Median and get the number of coordinates in the response, but (a) that can sometimes be slow and (b) won’t work on some distributions.

Why am I doing this? Trying to write a ResourceFunction provisionally titled NegativeCoordinateMarginalDistribution that would let you specify the coordinate with a negative value the same as you can specify a Part with a negative value. Useful if you want the last marginal of a distribution but aren’t sure how many coordinates the distribution has.

This won’t work perfectly for everything but it will probably cover a whole lot more cases:

DistributionDomain[dist] // Length

From https://mathematica.stackexchange.com/questions/224432/domain-of-probabilitydistributions and https://mathematica.stackexchange.com/questions/46309/determining-the-dimension-of-a-probability-distribution/46310#46310.