So it seems the cages were built during the Obama administration to house the spike in influx of migrants to the USA. The migrants consisted of women, men, and children, some of whom were unaccompanied? Is this correct so far?
Yes.
There was then a whole complicated fight over under what conditions children could be held in them.
Was it a surge of just unaccompanied minor migrants or just an overall surge in migrants altogether that resulted in the building of the cages.
Both. There was major surge at the border in general, and among that was a surge in unaccompanied minors.
This is a chart from US Border patrol about crossings.
See that really high blue line? That's FY 2014, when there was a big increase in the number of people caught crossing into the US between ports of entry (apprehensions) and the number of people who came
to ports of entry without immigration papers — for example, to seek asylum (“inadmissibles”). The orange line is 2017, crossings were going hugely down when Trump (and Miller) decided to implement the family separation/zero tolerance policy. There were families separated under Obama, but usually it was because the dad had been found smuggling drugs or something. Trump's standard policy was to separate the children since everyone was going to be arrested and you weren't supposed to put the kids in an adult detention center.
The 2014 spike was mostly driven by people under 18 coming to the US without parents or guardians. The feds had a system to deal with that, but it got overwhelmed and so the government put the kids in the temporary holding shelters (which look like cages). So in some ways, Obama's problem was he was trying to have a tougher policy to act as a deterrent to the surge and the system got overwhelmed. Separating the kids wasn't policy and they weren't supposed to keep any kids for more than 72 hours but the system got overloaded. Trump's policy was that despite far fewer people arriving, everyone should be arrested and the kids taken away.
Now there is another surge of sorts at the border, and especially with COVID restrictions in place, space is limited and Biden is housing kids in temporary shelters again.