The thumbs forward position, one behind the other, does a very important thing when done correctly.
It helps lock the wrist and greatly helps with recoil and aiming.
To avoid the slide hitting the thumb, simply keep a small gap there, similar to keeping the trigger finger slightly away from the frame, to prevent pushing the gun sideways.