Understanding digital filters, specifically their effects on time domain information, how to preserve the waveform of a signal being filtered?
What you are seeing is not wrong at all. To illustrate this I have generated some plots that may illustrate the point.

I decided to start from a signal that has many spectral components, namely a block pulse (the signal is assumed to be periodic). This signal is the unfiltered signal.



Now let's see what happens to that signal if we filter it perfectly. We cut off all spectral components after the 50th bin. Our filter will also introduce a linear phase shift.



A linear phase shift is added to the phase of the original signal, which causes a delay, in this case of about 30 samples.

Now let's look at what happens when a severely nonlinear phase shift is introduced!



It is immediately obvious that there is something off about the signal. The author of your book calls this "distorted". How should you interpret this?

In order to shift a spectral component, a sine, with a fixed delay \$t_d\$, we first need to determine what this means for that spectral component!

\$A\cdot \sin (2\pi f(t-t_d)) = A\cdot \sin (2\pi f - 2\pi f\cdot t_d)\$

\$\Rightarrow \phi = 2\pi f\cdot t_d\$

So in summary, in order to shift all spectral components by the same time delay, you need to shift them by a phase proportional to their frequency. The latter meaning that the phase shift needs to be linear.

As you can see, it does not necessarily mean that the waveforms look the same after filtering, because that is just what filters do. But, if you want to keep all spectral components lined up neatly in the time domain, you will need to enforce a linear phase shift.