I can think of 3 options.
1) Remove the entire circuit board from the motor block, leaving only the motor and battery. Place the new 2.4 GHz receiver/ESC in the old motor block where the 27 MHZ circuit board was in the motor block. You might have a hard time finding one that fits.
2) Remove the entire circuit board from the motor block, leaving only the motor and battery. Place the 2.4 GHz receiver/ESC inside the loco body(in the compartment behind the seats... if you install the wall behind the seats backwards, then it can be opened again easily for access) then have the wires to the motor go down into the motor block in a similar fashion to the lighting wires, but connect directly to the motor. You also need to have the battery wires go up to the receiver/ESC in the loco body. You could have 2 wires from the batteries to the loco, then tap off of the power from the receiver/ESC for the lights, then have 2 wires go back down to the motor... so 4 wires total between motor block and loco.
3) Keep the original 27 MHz circuit board in the motor block, but bypass the receiver section of the circuit with a 2.4 GHz receiver in the loco body. This way I guess you would use the original ESC and H-bridge, but you would need to know the playmobil motor block circuit board well enough to know where the receiver section of the circuit ends. You could of course experiment to find where to connect the 2.4 GHz receiver to bypass the 27 MHz receiver.
Note: The link which Gordon supplied involves a 27 MHz RC car system. There are 2.4 GHz playmobil RC car systems, but I doubt they would be ideal for this situation as the playmobil 2.4 GHz controllers do not seem as suitable for trains.
I wonder if the circuitry from the playmobil 5258 could somehow be repurposed. I'm not sure how it could because the 5258 uses two motors instead of 1. But if it could be repurposed, then maybe you'd have directional lighting, sounds, and unfortunately the same lack of smooth speed control.