The doctrine wasn’t officially defined as a doctrine until the 1900’s. However, it is important to understand the nature of Catholic Dogma. Generally speaking, the Church does not proclaim a dogma until a particular position is directly and consistently challenged.
Take, for example, the Council written about in Acts. There, Peter makes the binding proclamation that it is not necessary to observe OT law in order to be a Christian. The reason he made that proclamation was that that position was being actively challenged at the time. This is also what happened with the cannon of scripture. The Catholic Church’s cannon has been constant since 313 A.D. (or 331 A.D., can’t remember). However, it was not proclaimed Dogmatically until the 1500’s, when the protestant reformers challenged it. The same thing is true for the Doctrine of the Immaculate Conception. The Marian beliefs had been under attack by Protestant groups for a few hundred years, and so the Church decided that it was time to make them official Dogma.
As to if the Early Church believed in it, some did and some didn’t, but I believe there is evidence that the majority did. From various paintings and writings we’ve found, it appears that it was a fairly wide-spread belief early into the life of the Church. I think Jimmy Akin’s book “The Fathers Know Best,” has a section related to what the Early Church Fathers said about Mary; and Tim Staples book “Behold your Mother” is probably your best bet for answering any of these sorts of questions regarding the Marian Dogmas.