Nothing is factually known not only about how Elements were written but even about Euclid himself. At one point even his identity as a single person was disputed, and some historians suggested that it was a name for a collective of Alexandrian mathematicians, something like an ancient Bourbaki, see Paumier-Aubin's Polycephalic Euclid. This idea is considered unlikely now. Recent studies of the diagrammatic method of Euclid's demonstrations suggest that postulates and common notions (a.k.a axioms) had to be formulated explicitly before the final version of demonstrations was written, because they are transparently alluded to in them, see Manders's classic Euclidean Diagram and Rodin's Doing and Showing.
However, it was felt by many that the opening definitions of Book I do not fit well with the rest of the Elements and are perhaps later insertions for didactic purposes, to accord with the Aristotelian idea of structuring science starting with definitions, eventually interpolated into the main text by copiers. Lucio Russo, of the Forgotten Revolution fame, makes a detailed case, based on textual and circumstantial evidence, that the definitions of Book I are excerpts from Definitions by Heron of Alexandria, an engineer and mathematician of 1st century AD known for his steam powered toys and a treatise on computational mathematics, Metrica, see The Definitions of Fundamental Geometric Entities
Contained in Book I of Euclid’s Elements.
Perhaps the most interesting part of Russo's speculation is his suggested view of interpolation's motivation. The traditional critique of Book I definitions, that they are useless in demonstrations, has the same air of anachronism to it as the common practice of first ascribing to Euclid the modern axiomatic method and then detecting his "gaps". Russo puts a less anachronistic face on it:
"In the history of thought we can recognize two completely different views about the function of definitions. According to the first view definitions have the purpose of describing the true essence of the defined entities, whose actual existence is of course considered to be independent of their definitions. In the case of mathematics this concept, which was sustained by PLATO and was dominant from the Imperial period until (at least) the XVIII century, implies, of course, that mathematical entities actually exist, independently from the mathematicians describing and using them. We shall call this first view essentialist or Platonic. This view was substantially shared by ARISTOTLE.
According to the second view, which we shall call nominalist, the function of definitions is the introduction of a short label for a long defining formula. The existence of the object so defined must of course be ascertained by other means. In the case of mathematics the existence of the defined objects can be warranted by means of their actual geometrical construction. This second concept, so completed, shall be called nominalist and constructivist... People sharing this second concept certainly realize the necessity of avoiding a regress ‘ad infinitum’ by assuming some undefined terms as a starting point..."
That a dispute between essentialists and constructivists took place in Academy after Plato, with Speusippus, his nephew, representing the former, and Menaechmus, the inventor of conic sections, the latter, we know from Proclus, see Bowen's Menaechmus versus the Platonists: Two Theories of Science in the Early Academy. Russo himself mentions that according to ANTISTHENES’ school "it is possible to give a definition of the composite kind of things or substances, whether they are sensible things or objects of intellectual intuition, but not of their primary parts (ARISTOTLE, Met., 1043b, 23–32)". Moreover, in Archimedes's and Apollonius's writings Aristotelian pseudo-definitions do not appear, and Apollonius explicitly describes geometric entities as motivated by everyday experience (e.g. lines by walls and roads), see also Acerbi Two Approaches to Foundations in Greek Mathematics: Apollonius and Geminus. That Euclid's text lends itself better to the constructivist interpretation is also confirmed by the already mentioned studies of the diagrammatic method.
Russo is known for somewhat bold conjectures, but his command of the original sources is not in dispute, he is not the only one to suggest interpolation, and in this case the idea is not too far fetched considering that most of extant copies of Elements date to Theon's IV-th century AD recension, which is known to contain interpolations, including his own. Moreover, Sextus Empiricus explicitly distinguishes between describing ($\upsilon\rho o\gamma\rho\alpha\phi o\nu\tau\epsilon\varsigma$) and defining ($o\rho\iota\zeta o\mu\epsilon\nu o\iota$) geometric entities, with only the latter applied to Elements and the former to the Book I style definitions.
"The identification of the mathematician actually referred to by SEXTUS is not too difficult, since the description of the point reported by SEXTUS is nothing but the initial part of the first of Heron’s Definitions (HERON OF ALEXANDRIA, vol. IV)... HERON’s Definitions contain not only complemented and illustrated versions of EUCLID’s definitions (as in the case of the circle) but also definitions of geometrical entities which EUCLID had not defined at all, such as circumference and trapezium. Some of these entities (not all of them) are nevertheless defined in the manuscript tradition of the Elements".