Yes, the meanings are related.
Train was first applied to the modern vehicle in the sense of a "train of wagons." Train was used (and still is) to talk about making branches or vines grow along a certain path. The idea with "train" someone is to help them get on a path and stay on it. It seems that it was mainly used for physical things such as training a horse, or training soldiers. I was not able to locate more examples but I would think that "train" might also have been used for swordsmanship and also musical activities like playing the violin or singing. We also speak of a "train of thought."
"to discipline, teach, bring to a desired state by means of instruction," 1540s, probably from earlier sense of "draw out and manipulate in order to bring to a desired form" (late 14c.), specifically of the growth of branches, vines, etc. from mid-15c.
Coach was a large kind of carriage. It was natural to transfer this to a train (the transportation vehicle). Coach can also mean to carry someone in a coach. The first recorded use of "coach" as a verb in the modern sense of "help someone with an activity" was in 1849.
1610s, "to convey in a coach," Meaning "to prepare (someone) for an exam" is from 1849
As a side note, this "backward looking" definition of "coach" is useful because it helps distinguish the difference between a trainer and a coach, a coach being a person who "carries you along" and gives you support and guidance. This sense is used in the modern expression "life coach" as someone who supports you, helps you through challenges or goals, and in general gives you a "push."