First, we must clarify the concept of B2. The standard of German B2 is to be able to use German flexibly and freely, which is equivalent to reaching the level of mother tongue. There are no obstacles in daily communication, dialogue, writing, listening and dealing with all kinds of life things. This is actually a relatively high level.
The above two years are only an empirical statistical result. Doesn't mean particularity. So the length of this time will vary from person to person. Some people have excellent language talent, good memory, learning methods, efforts, language environment and so on, which will shorten the time.
On the contrary, if these conditions are not met, the time spent will be extended accordingly. Everyone's actual situation is different.