waht caused compactification of the extra dimensions in the early universe?
I don't think one can say. String, with it's extra dimensions, is not widely accepted in cosmology. In ordinary workaday cosmology one doesn't assume that there are any compactified extra dimensions.
No explanation for their existence is therefore needed. And in any case none has been offered by the string theorists themselves---imagining different dimensionalities with dimensions rolled up various ways are simply ad hoc choices, which lead to millions of different versions of string, with no clear way to select one corresponding to our reality.
For practical purposes, in ordinary working cosmology one can forget about that extra dimension stuff.
There is however a field called "quantum cosmology" which some years ago had a fair amount of string input. The prospects for string and for string-inspired cosmology looked more promising back in the 1990s.
You can get an idea of the current state of research in quantum cosmology (QC) by doing a keyword search in the Spires research archive
The field of quantum cosmology has been largely taken over (if one looks at the topcited recent research papers) by an alternative to string: Loop QC.
Most of the papers in the top 25, whether or not they say so in the title, are use the Loop QC approach to explaining the big bang. Public media has not caught up with this shift.
Well, according to a string theory book that I read, all dimensions were curled up like that until the big bang when four of them expanded. So another question would be why did only four expand and why these specific four.
And that of course begs an additional question: why are they compacitified now? For string theorists, one answer would be that it's those extra dimensions that control string characteristics and without that additional geometry, all particles would cease to exist...there would be no cosmos.
Separate names with a comma.