its generally necessary since the point the 2 doses is crucial.. the first one activates the cells that comprehend and keep note of what kinda virus or protein it is from the does.. and then it readies the antibodies accordingly from what it understood from the first dose, the second time the dose is given triggers exponential production of antibodies in your body. So its a matter of getting your body to first comprehend the virus and start making antibody, the second dose works as an impetus that exponentially increases antibodies in your body.
here is a graph that represents what i said