Or were there a lot of them? I feel they would be strategic locations
Off the top of my head, I know of one: the battle of Monte Cassino, in Italy. Monte Cassino was a hilltop abbey that the Allies thought was an anchor point in part of the defensive line the Axis threw up across Italy.
When the first attempt to breach the 'Gustav Line' failed, the Allied commanders decided it was because the Germans had used the abbey as a defensive position and artillery spotting position. So they decided not to let them use it again: B-17s came over and bombed the crepe out of it in February. 1944.
As it turns out, the Germans weren't using Monte Cassino at all, having agreed to attempt to protect its history. However, the rubble and ruins made for great defensive positions, so they moved in. It held the line against repeated attacks until May, 1944.
Allied casualties were ugly, with the Polish II Corps suffering particularly heavy losses.
Monte Cassino remains perhaps the most popular in imagination, but what made it important was neither the presence of a Medieval abbey (though the Allies certainly felt it would be occupied) nor the percieved defensive bonuses it [would not have] provided. Rather it was a dominating land mark; being something of a considerable piece of high ground, and was used to great skill and effect to paralyze movement via observation.
In reality, most Castles were incidental. There are scattered cases of Germans fighting from smaller fortified manors during the defense of their homeland, but in terms of bitter battles being fought over positions of strategic purpose: No, not really. They simply weren't teneable half the time; as they proved to be simply fantastic targets to eviscerate from the air (as indeed, the empty Abbey at Monte Cassino would prove). The high ground, once entrenched, that these castles stood on, would be of a far more important strategic nature.
The only thing that comes close to what you're looking for, in my mind, is the Kasbah during the Battle of Port Lyautey. Even then, I would deem it a footnote at best. The Kasbah was an obejctive as it controlled and overlooked the mouth of the river in which the US Expeditionary force were attempting to steam up and capture. It thus was one of the immediate operational objectives for landing units in the Task Forces formed from the 9th ID and 2nd Armored. The village near the Kasbah was being used as a firing position by Vichy coastal batteries; and most historians believe that the small company sized garrison in the Kasbah were relaying fire corrections from there. The Kasbah resisted for 3 days, despite high ground all around it being secured by the advancing American forces. Only a modicum of cannon fire came from the ancient fortress itself - as it was not meant to fire modern 75, 105 and 155mm howitzers.
Source: "Hell on Wheels: The 2nd Armored Division" Houston, Donald, E. 1977.
I know of another very small but curious battle. Fought just 3 days before VE Day, there was the Battle for Castle Itter. Apart from involving a 13th-century Austrian castle, this battle is also noteworthy for being possibly the only battle in WW2 in which US Army and German Wehrmacht soldiers fought as allies. The castle was used as a VIP prison by the Germans. When the prison was liberated in the final days of the war, US soldiers, French former prisoners, Austrian resistance members, and German Wehrmact soldiers allied together to fend off an attack by SS troops intent on retaking the castle and executing the prisoners.
Source: "The Last Battle: When U.S. and German Soldiers Joined Forces in the Waning Hours of World War II in Europe". Harding, Stephen. 2013.
I thought of another situation where a castle was involved during WWII... though it might not be exactly what you're thinking of.
During the invasion of Okinawa, the defending Japanese in the south of the island had a number of supporting defensive positions. One of the main ones was the "Shuri Line", based upon Shuri Castle, the ancient home of the Ryukyu kingdom. For two months, the Shuri Line held against the attacking Americans.
Eventually, the Japanese defenders abandoned the line after the Castle was basically obliterated by three days of bombardment by the USS Mississippi and her twelve 14" guns, along with hundreds of smaller guns and bombs.
It was still a viable defensive location, but the Japanese high command decided that to stay there meant the battle would end faster, and their orders were to stretch out the fight for as long as possible, and take as many Americans with them as they could.