The Gemara determines the shiur mikvah to be "water that one fits his entire body into" which chazal determine to be 40 seah. Tosafos seems to be bothered with how one can fit his head into the mikvah since a height of 3 amos for the mikvah will not include the head. Tosafos answers that one can tilt their head to squeeze it in. Another solution found in Tosafos Yoma 31 d.h. amah is that the gemara is giving the shiur of water, but the actual pit is larger and the water level will rise as he enters so it will cover his head.
The Turei Even explains that we really have 2 sources in the torah. 1. We learn from "ub'a hashemesh v'taher" that just like the sun setting is all at once, so too tevillah can't be lechatzain (half and half), rather one's entire body at once. 2. We learn from the drasha of "mayim shekol gufo oleh bahen" that even a short person who can fit into less than 40 seah, needs a minimum of 40 seah. In other words, there is a practical din that one's entire body must be immersed, but the din taught in our gemara is not a practical din rather a din in shiur that a "mikvah" must have 40 seah. Based on this, perhaps the gemara understood that the "kol gufo oleh bahen" is his body without his head and therefore determines the height of a mikvah to be 3 amos which is the shiur of the mikvah (even though it will not cover his head), but there is another din (that is learned from the torah kohanim brought in Turei Even) that the entire person including the head must be immersed at once.