You're right that the plan wouldn't have worked from a logical POV - if BW Megatron had killed Optimus Prime and the Maximals never existed - as was the plan - then Megatron wouldn't have been there with the Maximals to kill Optimus Prime in the first place. But it was a great season cliffhanger.