I've used the plotting of the Horizons projection described in this answer to show the distance between the Roadster and Mars out to 2030. The projection is likely to be slightly revised as future optical detections described here come in. There is also more to read in this answer.
There is quite a close approach between the Roadster and Mars predicted in late 2020, only about 7 million km. Without the overshoot, it is possible a close approach wouldn't be possible due to phasing reasons.
Normally you would have a launch window scheduled at a certain time of year for a planetary mission, but in this case that wasn't possible. So instead, with the launch date fixed by other constraints, the period of the orbit needed to be tuned (via the apoapsis among other things) so that the flyby would occur in the near future.
I'm proposing that this orbit is not an accident, but that some careful calculations were done and (some of) the 3rd and final burn parameters were tweaked in order to produce a near approach to Mars in within the next few years. It could be just an accident/coincidence, but as they say, space is big...
Distances of Roadster to the Sun (small wiggle, yellow), Earth (medium wiggle, blue) and Mars (big wiggle, red).
note: The current projected orbit has a period of about 558 days.