yah, this is more for low density/mid density housing, I am sure the roots of 2-3 floor apts should be more than enough to sustain it as energy needs of apartments are lower to begin with. They can also bleed them into parking lots and have cover from the sun.
Even at 2-3 stories, I'm skeptical that there's enough roof surface area to provide enough solar panels to individually cover the electrical use of all the inhabitants. Many 2-3 story apartment buildings don't have parking lots at all - and it's a common pro-density urbanist political project to remove the requirements to build one, because it discourages car use and also makes projects cheaper - but even if they did, a small apartment also means less surface area for solar panels over the parking lot. And once you're in a building with multiple households, that means that the solar panels - and the amount of energy every individual household draws from them - has to be managed communally. I'm glad I don't have to justify the power use of my home server to a group of my neighbors concerned about managing a common resource, and just pay my power bill to the de-facto-monopoly state-regulated electric utility company.
You would be surprised how little power european households consume, but we do have central/gas heating so the math doesn't always work out perfectly. 100-200W for lights/tv/fridge, oven/induction/kettle for 2h ~2000W a day. That's something the solar panels can most definitely handle, of course this is on case by case basis. I consume 300W at idle as I have a home server :)
Apartments have walls too, but we're getting into a territory where it might start becoming ugly.
If you care about getting the population to switch en masse from gas heating to electric-powered heat pump heating - which is an explicit social/political goal of a number of people I know, and one that I'm simultaneously sympathetic to and have serious qualms about - then everyone's gas consumption needs to go down and everyone's electricity consumption needs to go up. Also once you have a heat pump, you have an air conditioner - it's the same technology - and that means that people will want to use it to cool their dwellings in the hot months of the year, even if they weren't previously able to do this with just a gas-powered furnace, resulting in even more electricity consumption.
Honestly, I think it's fine to just keep the electric grid as it is, and not attempt to power every building only from the amount of solar electricity that it can generate from its roof area. The electric grid lets us take advantage of economies of scale, build gigantic solar arrays or nuclear power plants on cheap land outside of town, and crucially leave the management of that grid up to one well-known organization rather than a consortium of several households in an apartment.
Well yah of course, the grid is useful. But new developments should just include solar and storage and simply become the grid I think that's a no-brainer, off-grid or micro-grid would obviously better, but I'd settle for a mix.