Your revised itinerary has:
- five flight segments in Europe/Middle East (CAI-DOH-FRA-MAD and HEL-DOH-DXB)
- maximum allowed is four
- three stopovers in the continent of origin (FRA and MAD at the beginning, and DOH at the end)
- maximum allowed is two
Your suggestion (ending HEL-DOH or HEL-DXB) will take care of both issues.
Sadly, you get no refund for the downgrade from 4 to 3 continents, and I think you still have to pay the $125 change fee