No (modern) international agreement condones wars of aggression. What article 5 of the NATO treaty and article 42 (7) of the TEU establish is an obligation to assist the country being attacked (with many nuances and caveats) and certainly not any obligation to help a country attack another one (even by remaining neutral). There is therefore no conflict of norms and no obligation towards the attacking country.
Both texts are written under the assumption that member states would respect international law and not attack each other (or anyone) and do not explicitely forbid providing assistance or really any military operations, they are only concerned with defense. As such, there is no need to be “allowed” to provide assistance, that's a given, and what these treaties create is an affirmative commitment to do it, under certain conditions.
Both texts also refer to article 51 of the UN Charter, which establishes a right to self-defence and foresees a quick involvement of the UN Security Council.
The retaliation question is a little more complicated. Neither texts spell out what should happen but it wouldn't make sense for an aggression to open a free for all. In general, “retaliation“ is also thought to be forbidden and assisting self-defence doesn't necessarily entail invading the attacking country (cf. the first Gulf war). It's difficult to see how an attack on the military forces of the attacking country could possibly trigger any self-defense clause or justify another assistance requirement.
In any case, the EU mutual defense clause is clearly subordinate to the NATO commitment:
Commitments and cooperation in this area shall be consistent with commitments under the North Atlantic Treaty Organisation, which, for those States which are members of it, remains the foundation of their collective defence and the forum for its implementation.
Conversely, article 8 of the NATO treaty provides that
Each Party declares that none of the international engagements now in force between it and any other of the Parties or any third State is in conflict with the provisions of this Treaty, and undertakes not to enter into any international engagement in conflict with this Treaty.
NATO countries therefore see their alliance as more important and framed their EU commitment accordingly. Incidentally, the EU mutual defense clause also contains another caveat to reaffirm the neutrality of several member states. In fact, the only non-NATO EU member state that does not maintain a policy of neutrality is Cyprus (which is denied NATO membership for obvious reasons).