I don't think the number of test flights is too high considering it is a mission profile that has never been done before, using engines that are still in development.
A 'traditional' rocket is lucky to get 5% of the launch mass into orbit, spacex are trying to reach orbit whilst having enough extra fuel to land the booster stage, enough heat shielding to re-enter the upper stage and enough control surface area to guide the upper stage to a precise landing point and have enough fuel left for a propulsive landing. Nobody had data on hypersonic airflow around a vehicle of that size and there are no wind tunnels that can do 27,000 km/h to test with.
Shuttle/Buran are the closest comparison and they did many test flights before they even put rockets on them (or put them on rockets, if you prefer).