Typically the process is that the contractor has an internal pricing team that figures out how much to bid on a contract. After the contractor wins the bid (assuming fixed price), they then staff it with some combination of employees with various rates to meet the bid cost. Then those employees write up a detailed set of requirements (keep in mind that this occurs after the bid has been accepted), and then the project begins and things really get screwed up. Life happens. People leave the company. Clients are waaaaaaaaaay slower than anticipated taking care of required administrative work like approving user access and granting PIV cards. Clients change their mind or didn't account for several important considerations that may or may not involve huge amounts of work.
So how do the companies remain profitable through all this? It's usually that as the due date moves closer and closer, employees are expected to just work more hours to account for the missed estimate.
This may come off as cynical, but the truth is that there is not a soul on Earth who could accurately estimate how much time will be required on a multiyear contract given how many variables are involved. So, I'm back to my original point- estimates are largely worthless and a waste of time. Yes, they are a means to an end, but are in no way a reliable indicator as to how much time or effort is actually required to complete the work.