It is often defended by Christians that evil exists because god gave us free will. And god gave us free will basically because he wanted to be truly loved. Not just "loved" by "mindless robots". So Christians are claiming it is not possible to have free will and be purely good. But doesn't god have these traits? As far as I know god is considered to have free will and is the definition of good. So if god's existence is not a contradiction, then shouldn't god have been able to create beings who can really love him without being capable of doing evil?
There is a key difference here between doing evil and the potential to do evil.
It is perfectly possible for a being to have free will and hence the potential to do evil, but to refrain from doing so.
This is how God behaves.
Christian dogma has it that, in practice, Christ was the only human who ever achieved that ideal and we ordinary folk always fall short. But that is more to do with the notion of original sin and the Fall than any logic-chopping over the nature of free will.
Catholics claim that original sin gives one a predilection to follow passions which lead to evil. A person (whether human or divine) who was created free from from original sin would be able to follow their intellect instead of their passions while retaining free will.
Furthermore, it is well to bear in mind that Mary's eminent sanctity was not only a singular gift of divine liberality. It was also the fruit of the continuous and generous cooperation of her free will in the inner motions of the Holy Spirit.
So according to the Catholic Church, God was, indeed capable of creating being who really love Him (by cooperation) without the resorting to usurping the gift of free will.
If you want to know, why, I think you'd have to ask the question on Christianity.SE because that's a theological answer. The simple answer here is yes God can do it without contradicting Himself or taking away free will.
Even St. Thomas Aquinas, who doesn't quite share in the same understanding of the Dogma of the Immaculate Conception as the modern Catholic Church wrote
Reply to Objection 1. After her sanctification the fomes remained in the Blessed Virgin, but fettered; lest she should be surprised by some sudden inordinate act, antecedent to the act of reason. And although the grace of her sanctification contributed to this effect, yet it did not suffice; for otherwise the result of her sanctification would have been to render impossible in her any sensual movement not preceded by an act of reason, and thus she would. not have had the fomes, which is contrary to what we have said above (Article 3). We must therefore say that the above mentioned fettering (of the fomes) was perfected by divine providence not permitting any inordinate motion to result from the fomes.
The fomes here being, I think, the stain of Original Sin. He says that the Blessed Virgin Mary could not be induced to commit any evil on account of the fact that she didn't act out of reason, therefore she was perfectly prudent and being perfectly prudent never actually sinned.
"So Christians are claiming it is not possible to have free will and be purely good."
Bringing in a Hegelian perspective, evil is total self-centeredness and egotism. A developing human being goes through a self-centered phase, then (usually) develops a more socially-oriented perspective. In this more developed phase it is possible to have free will and not be evil.
From The Science of Logic
Remark: The unity of the One and the Many
Self-subsistence pushed to the point of the one as a being-for-self is abstract, formal, and destroys itself. It is the supreme, most stubborn error, which takes itself for the highest truth, manifesting in more concrete forms as abstract freedom, pure ego and, further, as Evil. ...
Crossing over to Peter Turner's interesting answer, I would say - instead of "a predilection to follow passions which lead to evil" - rather, (in the Hegelian vein), it is a predilection to follow very selfish passions which actually is evil.
It is true, as Paul says, that love is held to be the greatest of the Christian virtues, along with mercy and forgiveness. These qualities contrast with most earlier religions and certainly with the Greek and Roman deities.
The very concept of love requires freedom, first in the separation of the lover from the beloved. The one must be distinguishable from the other, independent of the other. One beloved must not literally depend on the other, thus retaining a relative freedom. In other words, the relation is not one of causal, mechanical dependency.
But freedom, in turn, requires the willful capacity to do otherwise, to decide, to change course. And this gives rise to the indeterminate "ought." Between the mechanical "do" or "don't do," digital "on" or "off" is the "ought." Only with a capacity to "have knowledge" of what one "ought" to do and a capacity to actually do otherwise can a being have the freedom required to fulfill the conditions of love rather than some mechanical or distinctive dependency.
Interestingly, a similar problem arises in a simpler form when Prometheus creates clay "mortals" as delightful playthings for his friend Zeus. They are nice to look at but somehow unsatisfactory until life is "breathed into them" inspiring and rendering them "spirited." But then, of course, trouble ensues. The logic becomes much more complex once a hypothetical omniscience and omnipotency is introduced.
This relation of freedom to universal rationality and morality is discussed most deeply, perhaps, by Kant, in a Christian context and consistent with doctrine, though without explanatory recourse to God.