Malls are generally just one or two stories tall and therefore a massive waste of space compared to other possible uses of the same land. Building them higher and putting housing on top is a great way to add more housing without using more land.
Most empty malls are in places where economic demand, including demand for land, is very low. Investing money to make efficient use of something that cheap is unlikely to be a profitable move.
The real waste of space is generally the ocean of parking that dwarfs the mall itself.
I wonder if there was an analysis of demand of parking space or if it was always at significant undercapacity
"Significant undercapacity" means that people don't leave when they can't immediately find a parking space (modulo maybe right before Christmas). Yes, I'm sure it's analyzed. Also adding space retroactively (especially in the form of parking garages that a lot of people don't really like) can be expensive.