How to unload filament as cleanly as possible using the extruder motor?
There's a bit of a compromise here:

Filament cohesion in the nozzle isn't strong enough to remove all residue at higher temperature

Extruder motors can't get sufficient grip / don't have sufficient torque for filament extraction at lower temperatures

That means you'll always have to purge some of the old filament when changing to a new filament.
To easily remove the old filament, you'd want to fill the nozzle, so that there's no large plug of filament that might get stuck in the Bowden tube (as suggested in a comment by Rosalie W), then pull the old filament out; and then purge the nozzle after inserting the new filament.
How much you'll need to purge depends a bit on the filament and its color, but I'd guess 50&nbsp;mm should be sufficient in most cases.

As G-code, this might look something like that:

;Unloading
G91 ;relative movement
G1 E5 F300 ;fill nozzle
G1 E-300 F3000 ;unload filament, 300 = Bowden length + hotend length
G90 ;absolute movement

;Loading
G91 ;relative movement
G1 E295 F3000 ;load filament
G1 E55 F200 ; purge filament
G90 ;absolute movement