please be aware that there are two kind of commands for setting the heater:
M104: setting of the hotend temperature
M109: setting of the hotend temperature and waiting until the temperature is reached.

The same is valid for the heat bed:
M140: setting of the bed temperature
M190: setting of the bed temperature and waiting until this temperature is reached.

So I you can modify your Gcode to set all temperatures first (using M104, M140) , then waiting for the temperatures to reach (M109, M190), each time with the same temperature targets. That would fit your expectations.