Forced to seek a government rescue barely a year ago, Siemens Energy AG was an unlikely candidate for Europe’s best performing stock of 2024.