That is partly true. High population density means a lot of roof area. Solar is perfect to put on roofs, you need no extra land. It is basically free (save the investment of the panels which pay off quickly nowadays)
Up until you start building cities and building with more than one floor. Then you have more people and power usage per roof area. Then you have to put solar panels on some unused area around city to offset that high population density.