Something that I've often heard from random people growing up is that castles were not actually lived in normally. That really they were basically just forts for times of war. Yet I've come to realize that nobody who has said that to me ever actually provided a source for it. Just the statement that castles were not actually homes and that all the films and shows depicting nobles living in them are wrong.
So this seemed like the most reliable place to ask. Is it true? Would nobility not actually live in castles or is that just an incorrect bit of pop history that's been spread around?
If this is too broad of a question (after all castles were around since the high medieval ages and feudal europe was a big place) then let's go with medieval france during the late middle ages to be more specific.
As you correctly stated at the end of your post. The middle ages is a very very long period, depending which historian you ask it goes from about 800 years to slightly less than 1300 hundred. In that period we see very much a continuation of the roman martial culture: As in the distinct culture that existed within the roman military. The army was divided between a field army and a frontier army. With the steady decline and loss of the roman administration within the western roman empire, the frontier armies slowly had to fend for themselves in terms of resources and manpower. Rather than rely on roman infrastructure we started to see the beginning of what we understand as feudal lords. Local military leaders living within forts or some other form of defensible structure at a strategic location. Some of these will end up being the later feudal lords, and in most cases they did live in some form of defensible structure. These could however be nothing more than a sligthly larger farm with a few extra pikes, depending where you were. Why did they live like that? Well as the western roman empire collapsed the soldiers on the frontier slowly stopped getting paid by the interior administration. Instead they usually either got some land in return for fighting for their officer (soon to become a feudal lord) or they would live inside his fort. As the military hegemony of the roman empire disappears a competition between the new feudal lords begins to ensure that they have sufficient manpower to keep their territory and possibly even expand. With that was the expectation to host warriors within your hall or fort and making sure they were comfortable. Slowly along the middle ages having a nice fort becomes part of enticing warriors to your lands when you don't have any more land to give. Having the nices fort (and later castle) becomes a competition of prestige.
Now we come to the field armies. Which often the emperor or powerful generals lead. They traveled usually to the most developed military towns and cities within the empire to keep both the borders and interior in check. The Kings of the middle ages copied this approach for much of the duration of the middle ages. Travelling with their entourage to the forts and castles they either owned themselves, or were lavishly hosted by the more powerful feudal lords.
In France you see "the end" of this with Luis 14. Frances kings has steadily centralized the state and power goes increasingly from the feudal lords to the kings. This period were met with many violent reactions from the feudal lords (including the english king who de jure was a french feudal lord. This is what started the 100 years wars). Luis 14. had himself fought back several revolts and civil wars knows as The Fronde. In response to that Luis decided to centralize the government even further. Not only was the King going to have more and more absolute power, but he would remain within one specific city. With it he began the ideas of courtly life with all its oppulence and pageantry. To have power and influence as a french aristocrat slowly went from being a powerful military warlord to become the kings wiper. The feudal lords - now aristocrats still had lands and titles, but as the states were centralized having power meant more and more to be close to the king and be part of the administration, than it was to be a strong military leader.
Sources: Hørby, Kai. Det Europæiske Hus - Den Kristne Middelalder.