Conflation of two ideas.
The origin of tartan, and its use in Scotland.
The origin of tartan as a clan uniform.
The stories vary, but there seems little doubt tartan has been worn in Scotland, amongst other places, for an awfully long time.
Possibly B.C.
There are many references to tartan of varying types being worn as markers of status, going back long before Victorian times.
As clans operated very much like a cast system, it is not unreasonable to assume that is the origin of clan tartans, rather than the introduction of the idea from outwith.
Naturally, going into battle one would want to indicate one's allegiance, lest one received a blow from one's ally.
The concept of individual dress as uniform would be an obvious evolution from such as a marker of status.