The castle and windmills at Consuegra don’t take more than a couple hours to see, less if you don’t go into the nicely restored castle, so if you decide to visit there consider also visiting nearby Campo de Criptana and its windmills. They are the ones mentioned in Cervantes’ Don Quixote. Then, as long as you’re in that area, Belmonte castle is nice to visit. You could then visit the already mentioned Chinchón on the way back to Madrid.
If you go to the Real Sitio de San Ildefonso it is best seen when the gardens are in bloom and the fountains are turned on. The palace and gardens are all there are to see there, but it’s only an hour from Madrid.
If you had a rental car and wanted to stay in a castle, then consider the Parador de Alarcón. There’s a nice walk that goes around the town, but there’s little to the town itself.
I always have a rental car so can’t speak to getting to any of the places using public transportation.