The shape of a volcano generally depends strongly on the viscosity of the molten rock used to make it:
- If the magma/lava ("magva"?) is relatively fluid, it flows out gently, and you get a pancake-shaped shield volcano, with very gentle slopes made up almost entirely of solidified bulk lava flows; gasses dissolved in lower-viscosity magvas are easily burped out, making explosions rare unless liquid water comes into contact with hot magva (either underground or on the surface), and, as such, pyroclastic deposits make up only a very small proportion of the bulk of these volcanoes, while the low viscosity of the erupted lava allows it to flow long distances before solidifying (hence the gentle slopes).1 Note (this will become important later) that these magvas are fluid and low-viscosity by magva standards; by human standards, most such magvas are still highly-viscous, flowing like shampoo or maple syrup rather than like water.
- More-viscous magvas are harder for gasses to gently bubble out of, and more likely to explode when brought up from the bowels of the earth, producing explosions and pyroclastic deposits; even when it erupts without exploding, the thick, pasty lava flows much more slowly and doesn't get as far before it hardens (instead of maple syrup, think peanut butter). The result is a moderately-steep-sided stratovolcano, composed of multiple layers of solidified lava flows, welded pyroclastic deposits (ignimbrites), pressed-together-but-unwelded ash deposits (tuff), and mixtures of any combination of the three.
- If the magva involved is sufficiently viscous (going from peanut butter to caramel), it simply can't erupt to the surface without exploding as the dissolved gasses depressurize into trapped bubbles, and you don't get any extrusive lava flows at all (at least early on in the eruption sequence).3, 4 Instead, if the eruption is on a small scale, you get a steep-sided pile of ash and broken rocks blown from the eruption vent (known as a cinder cone);5 if larger amounts of magva are involved, the eruption starts getting explodey enough that it blows away more material than it deposits locally, and (especially when combined with the tendency of large, newly-emptied magma chambers to collapse under the weight of all the rock on top of them) you get a big hole in the ground,6 rather than the classical hill-or-mountain-shaped volcano.
Remember, even shield-volcano lavas, like you see in places like Hawaiʻi, are generally still quite viscous, sticky, and slow-flowing by human standards.
Now consider two volcanoes in the East African Rift whose lavas are extremely fluid and fast-moving even by human standards - Nyiragongo in the far-northeastern Democratic Republic of the Congo, and Ol Doinyo Lengai in northern Tanzania. Given the types of volcanoes you get from lavas that flow like maple syrup, one would expect that these volcanoes, with lavas that flow quite literally like water, would be shield volcanoes, and very flat ones indeed.7
Instead, both Nyiragongo and Ol Doinyo Lengai are fairly-steep-sided stratovolcanoes.8
How did these two volcanoes, both of them having lavas more fluid than those of most shield volcanoes, end up as steep-sided stratovolcanoes?
1: This should in no way be taken as meaning that shield volcanoes are incapable of reaching great heights. Quite the contrary - not just the tallest volcanoes, but the tallest mountains of any sort, both on Earth and in the entire solar system,2 are shield volcanoes. (This makes sense when you think about it, as their more-fluid magvas have an easier time percolating up through the plumbing to the surface without getting stuck along the way, and these docile volcanoes are the least prone to blowing themselves to bits.) However, this tallness, in a shield volcano, requires a truly-enormous horizontal extent to support it.
2: Granted, the latter of those has the advantage of being on Mars, where the lower gravity means that liquids of all sorts, including lava, see less urgency in flowing downhill, allowing volcanoes to be steeper and pile up higher than they would on Earth.
3: Over the course of an explosive caramel-volcano eruption, some of the magva deeper in the volcano's belly can sometimes depressurize slowly enough for the bubbles to - very slowly - work themselves out in pace with their generation, allowing this portion of the magva to degas nonviolently; late in the eruption sequence, this degassed magva can reach the surface in effusive lava flows. This forms only a small portion of the volcano's total bulk, though.
4: Of course, if the magva cools and solidifies while still deep underground and under high pressure, the gasses don't get a chance to explode it, and you end up with large solid formations of bulk intrusive rock (such as the granites that form the cores of many a continent), even from the most viscous magvas.
5: As @Jean-MariePrival correctly points out in their comment, cinder cones can form from magvas with a very wide range of viscosities, and most cinder cones actually have low-to-midrange-viscosity magva (but are still steep, since it's still a pile of rocks and ash, which don't tend to flow very well); however, cinder cones can still form even with extremely-viscous magva that's too pasty and explodey to make a shield or even a stratovolcano, hence their being mentioned in the third bullet point rather than one of the first two.
6: The relative contributions of the blast-out effect and the chamber-collapse effect vary between volcanoes and between eruptions; in general, holes in the ground produced by smaller and/or less-explosive eruptions are primarily due to collapse, while those produced by really really big explosions, as one might expect, owe more to the boom side of things.
7: Indeed, Nyiragongo's sister volcano, Nyamuragira, is a bog-standard shield.
8: In Nyiragongo's case, the combination of steep sides and extremely-fluid lava leads to the fastest lava flows of any volcano in the world. Lava flows that move faster than many speed limits are, for obvious regions, extremely dangerous; this is why Nyiragongo is one of the sixteen Decade Volcanoes.