This is a video by Shadiversity explaining some of the reasons why medieval people used jettying (overhangs) on their buildings. It's a bit slow but does mention several factors involved both with regular houses and with castles.
There are so many things that influenced why people act the way they do. I don't know that I've ever seen a fantasy novel mention jettying or taxes on the ground floor square footage or... But these are fascinating aspects of life, and even if they're not cribbed exactly, it's the kind of stuff that makes a world feel real.