Since I'm not very skilled at math, I'll try to explain my problem with apples.
At a certain train station, every train driver has a specific route to cover everyday.
A pair of brothers, who happen to work at the same station with the same schedule, both have been assigned a route next to each other, and so, they're able to talk along the way without any radio interference, given how close they are to each other.

One day, after one of them got assigned a new route, they began having trouble to communicate; since they were not moving at the same pace anymore, the increasing distance between them started to produce transmission issues; and so, our problem begins.

- If the two brothers stay at the same pace, they won't be able to finish their routes at the same time. ['A' & 'B']
- Even if both move at the same relative speed, lets say, 1% per second, eventually they'll end up shifting away, since
(1% of 10) != (1% of 6.4)['A' & 'C']
Is there any way to accomplish the following objectives at the same time:
- Both trains must complete their routes, as usual.
- Both trains should stay as close/aligned as possible along their way, to improve radio communications.
- After all, it doesn't matter if they end up shifting away: It's all about maximizing how much time they move along and/or minimizing their relative displacement from each other.
Additionally, we need to consider the following:
- There are no speed limits.
- Both trains have same length.
- Tracks are static, so moving them to reduce gap between trains isn't possible.
- Focus must stay on the trains. (Ignore the radio frequency/power, schedules, weather, fuel, etc...)
- Both trains must:
- Start at the same time.
- Finish at the same time.
- Start from the same point.
Optionally, these would be desired:
- A way to solve this with N trains.
- Any speed compensation should start from the beginning, smoothly increasing towards its maximum.
- Solution(s) should avoid functions whose behavior looks very sharp at first glance, until you «zoom» enough on it, like a «microscopic» curve.
- In other words, there needs to exist some kind of limit into how smooth a function can be, be it a speed, acceleration or jolt limit.

"Microscopic view of a bee sting (sharper) vs a needle tip (rounder)". Source: Twitter.com / @microscopicture
Given the above, the ideal answer would look like this:

Where both trains start & stay at the same pace, just as if both of them had to cover up the same distance (Fulfills objective #2), just for one of them to «teleport» the very instant any of the trains reach their destination by conventional means (Fulfills objective #1); while effectively solving our problem, such approach isn't smooth at all, which would be desired, if possible.
Resulting behavior should look like this:

Just by using common sense, my logic tells me that there must be a relationship between the «absolute difference between route lengths» & the «speed compensation». That is, the bigger the difference, the faster one train might need to go.
Particularly, I feel like this might be solvable by using a custom smoothness variable/factor, but I was wondering if there could be a more «natural» way to do it; that is, only using information provided by the problem itself, like the above.
If there's not, maybe using e, pi, phi or some irrational number/function for such custom variable might do the trick.
EDIT: Despite the problem-solving tag, I'm actually looking for a concrete solution/example to this, but I'd greatly appreciate any kind of help, including guidance on this; hence, the tag.
I will use your ideal solution as the starting point. Your ideal solution is a piecewise function $s: [0, 1] \to \mathbb{R}$ where $$s(t) = \begin{cases} 6.4 t \text{ if } 0 \le t < 1 \\ 10 \text{ if } t = 1 \end{cases}$$ Graphically, it looks like
Obviously, $s(t)$ is non-smooth because it is discontinuous at $t = 1$ (the train teleports at $t = 1$).
To fix this problematic jump, we can smooth out the function using a smooth transition function. Our method is very similar to the one mentioned in Smooth Bump Function Between Two Functions, but I feel like it is easier to use the smooth transition function defined in Wikipedia.
Let $f: \mathbb{R} \to \mathbb{R}$ be given by $$f(t) = \begin{cases} 0 \text{ if } t \le 0 \\ e^{-\frac{1}{t}} \text{ if } t > 0 \end{cases}$$ Then $g: \mathbb{R} \to \mathbb{R}$ defined by $$g(t) = \frac{f(t)}{f(t) + f(1 - t)}$$ is smooth transition function from $0$ to $1$ in the sense that
The proof can be found on Wikipedia. Graphically, it looks like
We can now use it to define what we want. Fix $\varepsilon$ with $0 < \varepsilon < \frac{1}{2}$ and let $s_\varepsilon: [0, 1] \to \mathbb{R}$ be given by $$s_\varepsilon(t) = 6.4 t + 3.6 g\left(\frac{t - (1 - \varepsilon)}{\varepsilon}\right)$$ Then $s_\varepsilon(t)$ is a smooth function because sum of smooth functions is smooth and smoothness is preserved by re-scaling and shifting. Graphically, it looks like
Notice the corners have been smoothened, which is what we want.
Here $\varepsilon$ can be thought of as the "sharpness" parameter. The smaller $\varepsilon$ is, the "sharper" the function $s_\varepsilon(t)$ is and the closer it is to $s(t)$. In fact, $$\lim_{\varepsilon \to 0^+} s_\varepsilon(t) = s(t)$$
Graphically, it looks like
Finally, to get a formula for $s_\varepsilon(t)$, observe that $f(t) = e^{-\frac{1}{t}} \theta(t, 0)$ where $\theta(t, t_0)$ is the Heaviside step function defined by $$\theta(t, t_0) = \begin{cases} 0 \text{ if } t < 0 \\ t_0 \text{ if } t = 0 \\ 1 \text{ if } t > 0 \end{cases}$$ Hence $$s_\varepsilon(t) = 6.4 t + 3.6 g\left(\frac{t - (1 - \varepsilon)}{\varepsilon}\right) \\ = 6.4 t + 3.6 \frac{e^{\frac{\varepsilon}{(1 - \varepsilon) - t}} \theta\left(\frac{t - (1 - \varepsilon)}{\varepsilon}, 0\right)}{e^{\frac{\varepsilon}{(1 - \varepsilon) - t}} \theta\left(\frac{t - (1 - \varepsilon)}{\varepsilon}, 0\right) + e^{\frac{\varepsilon}{t - 1}} \theta\left(\frac{1 - t}{\varepsilon}, 0\right)}$$ is the desired formula.