Did the Roman military come up with their version of the shield wall/phalanx, or did it copy and modify an effective technique that Greece had used? And after Rome left Britain and Germany and other such areas, did their former battle technique get copied and passed down to result in the shield wall used by the "barbarians" after Rome left those lands?
If they were copied and adapted, did it happen by learning from enemies, absorbing the old culture then keeping it when the old culture left, or some other reason?
The first known Roman army set up known as the Servian army used a phalanx very simmilar to that of classical Greece, but eventually adopted the maniples of the Polybian legion forgoing spears in favour of javelins, swords, and the rectangular-ish Scutum shield (as opposed to the circular aspis). This occurred either gradually as some scholars think or rapidly following tough campaigns in Samnium where the rough terrain made a phalanx virtually redundant due to the difficulty of the men staying in step with one another. The Legions would fight in this form of flexible shield wall that could form and reform freely for the remainder of the Western Roman Empire, and even beyond as the traditions and training of the Roman Army continued in the East.
In the later Empire when the West came under pressure from Barbarian tribes in Britain, Gaul, and Germania shield wall tactics appear to have been used by both sides, quite possibly because the Romans had taught their enemies how to fight in their style. Rome recruited extensively from Tribes such as the Goths making them Foederati, only for these Barbarian troops to turn on them a la Arminius. However one ought to be cautious about ascribing the shield wall tactic to any single culture or state, with each different Army using the same principle in different ways to achieve different results against different enemies. Certainly the Romans were well drilled in their own particular brand of shield wall, especially in comparison to the non-professional opponents they often faced.
The process of adoption is very much a topic of debate. Whether Rome conquered then adopted, adopted over a very long period of time, or adopted rapidly due to setbacks or changing conditions is almost impossible to prove and the truth of the matter is likely to be elements of all possibilities, with the added confusion of different theatres requiring different adaptations. For example, the Lorica Segmenta (Hollywood Roman Armour) was rarely worn in Syria due to its side affect of being a cooker, and was dropped in favour of the hamata, chainmail, whereas on the northern borders, chainmail was less effecive against the axes and sweeping blades of the unconquered men beyond the Rhine and Hadrian's Fence. Ultimately the army was fluid and dynamic, with kit reflecting the commander's own ability to adapt as well as any notion of standard doctrine. It is worth noting that until the 1st Century BC, there wasn't even a state armoury providing uniform kit, rather individuals provieded their own.
Sources: Polybius' Histories. Best primary source on the Roman Army that survives in my opinion. The Complete Roman Army - Adrian Goldsworthy Greek Warfare - Hans van Wees Trajan's Column has invaluable depictions of Roman soldiers at the height of the Empire.