I do wonder why and how green parties were able to get everyone else to retire nuclear plants but then nobody (green, blue, red, etc.) set plans in motion to replace it.
Your first question has a simple answer: by law. New nuclear plants haven't been licensed in Germany in, like, forever. Currently, the law explicitly states that no new nuclear power plants will be licensed.
How they got the operators to agree to the early shutdown is less clear. By offering a good deal, I guess. It's only taxpayer money, after all.
Why nobody set plans in motion to replace it? I don't know. My best guess is, because politicians are unbelievably stupid. They really don't know anything about electricity. They really don't get that excess electricity in Juli doesn't help you in cold, dark January. Annalena Baerbock stated publically: "The grid is all the battery we need." At that level of incompetence, who knows why anything happened.