Pertaining to Mars habitation, eventually, could the answer be in burrowing into the ancient volcanoes instead of building the habitation outside in the open? Since Mars does not have magnetic shielding like the Earth, could this help in mitigating the harmful radiation from the Sun?
Yes, eventually, but we would first have to establish structural stability of any such rocks, get a sense of Martian subsurface seismic activity, seasonal changes to its thermal characteristics, how fast would aeolian processes block access to it, amount of volatiles embedded within the rock that could collapse it during drilling or with higher temperatures of the habitat, get the heavy equipment needed to do that there or make it on site once we have the other needed facilities to do so and learn to use Martian resources to support such industry, and we might not need to resort to such drastic measures either, if we learn to use the Martian regolith as bioshielding mass instead. Let's expand a bit on all these points;
First, ancient volcanoes might not be the best choice as they tend to be rather porous and unstable due to the many pathways that the flowing lava would take through them, and the pressure building within it prior to eruptions also tends to form deep cracks. With Martian nearly three times weaker gravity than on Earth, the sheer weight of such formations isn't compacting the structure as fast as we'd expect here and they tent to be taller due to it. Much taller. Not as much of weathering and no tectonic activity on Mars slows this settling of rock even further. The residual heat after volcanoes being active could also allow volatiles to flow deep into these cracks and fill them. As they eventually freeze, they might also expand (water) or contract (dry ice) and crack or loosen the rock further. A better choice might be calderas that already collapsed and were later filled with once flowing and later solidified lava. If this process happened in Martian ancient times when it still had some planetary magnetic field, such solidified lava beds would also remain slightly magnetic, forming what we refer to as remnant magnetic field. Mars has spots on its surface where this magnetic field is present, but sadly, at perhaps up to a couple microtesla at its best, it is rather weak (about 30 times weaker than the Earth's magnetic field at its surface) and fairly localized.
Second is that Martian surface is active and the planet has seasons just like the Earth has, only even longer and with bigger surface temperature differences. Perhaps the most obvious surface processes are winds that can cause global dust storms, and they cause various aeolian formations, both wind erosion as well as sedimentation. This could mean that entrances to caves could get blocked by sand. But perhaps still less well known are the seasonal fans that come to life during Martian springs, formed by dry ice (frozen carbon dioxide) embedded into regolith during winters and later warmed during springs. This can cause violent (read: explosive) release of volatiles beneath the regolith and forms dry ice fans that were observed on Mars. Granted, we could select areas where this isn't an issue, but what I wanted to demonstrate is what the large temperature difference between seasons can cause. Obviously, rocks would also be a subject to these seasonal temperature swings. Depending on their thermal characteristics, it could cause additional loosening of its materials closer to the surface. And if they embed much of volatile materials, as discussed earlier that they could, such environment can quite literally be explosive. Especially if we try to build a habitat on top or within it, that could act as a pressure cooker's lid.
Third is of course that we'd require quite a bit of fairly heavy equipment to dig any such burrows. We don't have that (the heaviest piece of equipment we so far landed there was about two metric tons heavy MSL), and nor we'll have it any time soon on Mars. But if you're ready to wait, then I guess we could eventually establish Martian industry and learn to use its many resources to build the heavy machinery needed. But the point I wanted to make is that by the time we'll be ready to burrow into Martian mountains, we'll have to have ways of protecting our habitats from dangerous radiation in different, more accessible ways. And luckily, Mars has a lot of sand, that could at first be used just as it is to provide the shielding material, and perhaps later be mixed with liquids to improve its strength and could be shaped for easier construction.
As for subsurface seismic activity on Mars, we'll only get a fair overview once the NASA's InSigth (Interior exploration using Seismic Investigations, Geodesy and Heat Transport) lander gets to the Martian surface, presumably in late 2016. So, until we have this data, it might be more prudent to search for more structurally stable natural caves, perhaps close subsurface lava tubes that can be many meters wide and, where flowing lava already started cooling down, can form thick and strong silicate walls surrounding them. some might also have natural exits into the open, and if they formed on a slightly inclined slope (they often are), wouldn't get blocked by dust as easily. Mind, we're still talking of untraversed, largely unweathered terrain here, and we'd be disturbing its millions of years undisturbed natural cycles (diurnal, seasonal,...) with human activity, including, quite possibly, heavy machinery and explosives. Each of such lava tubes would have to be first inspected on site, and might need structural reinforcing. Make sure you bring along many structural engineers, geologists and seismologists.
So, TL;DR - We might one day learn to dig deep burrows into Martian slopes of this and that variety, but we'll have to learn to do without that anyway, if humans are to colonize Mars at all.
I'm no Martian geologist but I would assume the rock composition in the volcanoes is different to the average for the whole of Mars - I wonder if this is preferable?
Certainty using solid rock for radiation insulation has been suggested before (that link is even about lava caves!). It could be helpful in mitigating the harmful radiation, any material (solid, liquid, or gas) is helpful for this purpose if you have enough it it.