In my experience of family history research I've found people's ages to be the absolute least reliable when it comes to determining a date of birth! When the census started in 1841 children's ages up to and including 14 years were recorded accurately. Anybody 15 years and over had their age rounded up or down to the nearest 5 or 10. This practice was stopped for the 1851 and subsequent census surveys but I've found examples in my family of enumerators who continued.
Going back to the 1800s quite a lot of people didn't even know their birthday. You are right when you say that parental consent for under 21s was required in 1866 but the legal minimum age for marriage was 14 for males and 12 for females. However, William would be well over the age of 21 so he wouldn't be needing any consent and wouldn't need to lie.
The 1841 Scotland census isn't available to me in its original form but a transcription gives William's age as 7 "mo". That census was done 6-7 June so this would give a birth date between 6th October and 6th November the previous year – 1840. This would fit in nicely with the birth date of William Taylor, registered in Meigle, Perthshire, as 25 OCT 1840 to James Taylor and his wife Jess (nee Walker).
That might be worth investigating further. Do you know that children in the 1800s were very often named in a certain order? I had a look at William and Elizabeth's children:
1st son is given his maternal grandfather's name. (Robert)
1st daughter is given her paternal grandmother's name. (Jess)
2nd son is given his paternal grandfather's name. (James)
2nd daughter is given her maternal grandmothers name. (Jessie)
As both grandmothers shared a similar name Jess/Jessie the 2nd daughter would possibly be given her mother's name - Elizabeth.
Carry on with the detective work!