Collisionless shock formation and the prompt acceleration of solar flare ions