Understanding how to proof an encryption scheme is perfectly secret
Where is the problem? Your reasoning seems correct, but you obviously are uncomfortable with probability (at least).

You used the definition of the encryption scheme in (1) and then the standard expression of a probability with respect to the set of messages forming a partition in (2), which is valid since it includes all the messages with nonzero probability and their probabilities must sum to 1.

You then applied Bayes theorem. Standard stuff, really. Maybe you need a refresher in probability.