I guess there are some situations where "to" is the best choice, although I can't describe what kind of that situation is.
There are three layers to the matplotlib API. src
There are three layers to the mandala... src
In these situations, it does not sound natural to substitute "in" for "to". Is my understanding correct?
In contrast, in the following situations, "in" seems more natural than "to"
A post on basketball says
There are 4 rounds to the playoffs: The divisional/first round, the Conference Semi-finals, the Conference Finals, and the NBA Finals.
I guess the word "to" there means
Composing; constituting
source: American Heritage® Dictionary
Therefore, I guess the first part of that quotation could be written as
the playoffs consist of 4 rounds
With that meaning of "to", does the following sound natural to native English speakers?
There are nine regulation innings to a baseball game
adapted from wikipedia
more examples
There are 3 parts to the IELTS Speaking section. src