Plan B is to stay in Milan for the night (additional costs), after
returning from Rome and then take the next night's flight..
Do you mean that you haven't booked your plane yet? Plan B means adding 1 night to your current itinerary (posted below) so you can be in Milan the night before a flight which leaves at 10:25 pm daily?
Day 1 - Reach Milan (Malpensa?) at night; "hope to arrive in Milan at around 7:30 pm"; sleep Milan
Day 2 - Milan
Day 3 - Train from Milan to Florence
Day 4 - Florence
Day 5 - Florence
Day 6- Train from Florence to Rome
Day 7 - Rome
Day 8 PLAN A: - afternoon train from Rome to Milan with onward flight to Doha at 10:25 pm
Day 8 PLAN B: late afternoon train from Rome to Milan, stay in Milan, fly home Day 9
So you may not have booked your flights and hotels yet? If that's the case, your itinerary as it stands is a lot of travel time for little sightseeing time in Rome. If you can swing an additional night, as you are considering, and as I'd strongly recommend, you might consider this instead?
Day 1 - Arrive in Milan 7:30 PM; sleep Milan
Day 2 - Train from Milan to Florence
Day 3 - Florence
Day 4 - Florence
Day 5 - Train from Florence to Rome
Day 6- Rome
Day 7 - Rome
Day 8 - afternoon train from Rome to Milan
Day 9 - fly home 10:25 pm
While I know your (tentative) arrival in Milan is in the evening, you still should have time to get through immigration, into the city and to bed in time for a good night's sleep, how you all manage jet lag excepting. Putting your sightseeing time in Milan at the end of the trip would place you nearer to where you want to be for your flight and give you more than 1 full day in Rome, which I think you need and would be well worth the cost of an extra night. You will also have a much more relaxed departure day.
Editing to add: on day 9, I'm quite sure your hotel will store your bags for you after checkout. Do your sightseeing and collect them before heading off to Malpensa, assuming that's your departure airport.