Castles and smaller fortifications also made a big impact on controlling the surrounding area for a considerable distance.
If you want to move an army into an area protected by castles, you could easily go around them with the defenders up on the wall only being able to watch you from the distance, but it would often be a very bad idea.
Because this means that you will always have to watch your back against small groups of soldiers striking at your rear, and all supply transports to your army would have to be very heavily guarded to protect them from the soldiers that could come out of the fortress at any time. You either had to take the castle, or leave a substential force to keep them from getting out and attacking your rear. Any solution would require a lot of resources and manpower, which you would really need in the main army for the campaign. And all the soldiers in the fortress have to do is be there. They don't need to break out, just by binding the enemies resources they are doing a great job in defending their country.
Built a small fortress close to a mountain pass or river crossing, and anyone wanting to use this route has to be on the lookout for its soldiers that are in the area. And of course, it would be in a position where they know any wagons are comming way in advance.