Yes that is a legal circuit. There are an infinite number of ways one can match impedance using an infinite combination of resistors, capacitors, inductors, stub and length matching.
However, as you pointed out, the choice of passive components will create a filter of some kind. The characteristics (attenuation, bandwidth, physical size, power rating etc...) will be optimized for the application.
As an example, a version of your drawn circuit exists for high speed digital. PCIe runs at > 1GHz and terminated for 85 or 100 ohms depending on the generation. That termination is usually done inside the IC using resistive elements. However, PCB designers need to add AC coupling capacitors in series to remove DC bias between the driver and the receiver. Also inevitably the PCB adds parasitic elements. The trace running over the ground plane is one capacitive source in parallel. The challenge here is to minimize these parasitics so that they don't affect the termination much. Unfortunately board interconnects are a great source of parasitics and is actually why the termination impedance was reduced to 85 ohms in newer specifications. That fixation on impedance matching means reflections are reduced and digital signals stay within the desired logic levels. On the bright side, digital designers don't worry about filter effects (as much). Digital logic switches so fast that the filter portion isn't as important. All the frequencies are in the rise/fall time portion of the signal where reflections are prominent. Before the signal get's a chance to settle, the logic level is likely to change. The result is something called an eye diagram.
Now let's look at the analog version. An RF engineer is going to be interested in their signal across a spectrum of frequencies. Their goal isn't just to match the impedance at the center frequency, but to ensure that they have good gain (minimal attenuation) over the bandwidth. One parameter of their design is Q factor. With this filter, we can attenuate noise outside of our signal's range while preserving ours. In this case, we have a wide variety of options available and each component plays a heavy role.