The reasons we stayed in each of them morphed as the years went by. Our immediate goal of stabilizing them took a minimum of ten years, arguably up to 20. The German armed forces were reconstituted in the mid-50s, around the time the surviving 10% of Germany's WW2 POWs held by the Soviet Union were finally returned to her. After the first 10 years, both countries still faced threats of internal Communist subversion, if no longer existential threats, but the main reason for us staying was more to counterweight external Communist threats on a regional basis rather than to back up the national governments of each former adversary.
Of course, that same need for basing rights to exert regional influence and suppress our biggest threats applies just as much to the CENTCOM area of operations now, as it did to the EUCOM or PACOM areas back in the depths of the Cold War.