Well, that depends on the load, right?
If your load inherently has low bandwidth compared to the speed of your switching, then that filtering element might not be necessary – for example, there's ICs that are class-D (-E, -G, whatever: PWM amplification) audio amplifiers for low-power low-cost application, where the speakers themselves are sufficiently slow (as in: actual mass inertia and energy stored in a magnetic field!) that the the average is found.
Other applications cannot accept these fast-switching signals at all: If you build a DC/AC converter for a few meters of cable (think: Uninterruptible power supplies), then your dozens-to-hundreds of kHz switching frequency will convert to electromagnetic interference pretty quickly, and the power supplies at the end of these lines have grid filters that are supposed to keep exactly this kind of noise seeping out of the supply back into the net, and will suddenly get very hot. Probably, they would even refuse to start to work.
Yet other applications honestly don't care. You use a switching frequency much faster than the human eye could perceive, neurochemically, and the whole point of your PWM is to modulate the brightness of some LEDs? Well, go right ahead; the averaging is done by the chemical processes that make up light perception.
And there's applications where digital PWM is actually the desired means of information transport – for example, if you have something that feeds a microcontroller with microphone signals from a microphone far away enough to warrant wanting to make the transmission down the mic line more robust against noise than it would be if it was the very small voltages and currents that a microphone itself would cause in the cabling? Compare with high-frequency sawtooth wave, get PWM, send PWM, receive, compare received signal with a rough midpoint voltage: Congratulations, you just eliminated everything but very strong noise from your signal. Reconstruct original signal, if necessary at all, in software.
A comment on your approach to filtering:
Waveform after proper filtering using inductors and capacitors at the
output of the transformer:
You don't say what you want this signal to be. Interestingly, your oscilloscope curves have nothing to do with your sine PWM example from the top of your question, so this is a lot of guesswork, and trying to read your mind, but, I can say with some sincerity:
You did some filtering but it's not the "proper filtering" you claim to and should be doing.
- Does that look like a sine? not to me! Also, you must have AC-coupled this, as you've actually lost the average of the signal, which would have been positive, and your AC output is zero-average. So, for some applications this is OK, for others, you might have wanted that actual DC offset that you have in your PWM output to persist! So, again, depends, but if you wanted to generate a sine wave from your PWM, then this was not appropriate filtering.
- If you wanted to produce a rectangular wave of some adjustable amplitude, it's not appropriate filtering, either. I don't see that approximate square wave that your original PWM signal suggests you might have been trying to produce.
So, take a look at the spectrum your PWM gives you, and take a look at the spectrum you want to generate. The job of your filtering – whatever shape it takes, and wherever it is happening, is to remove all components from the PWM spectrum that should not be there in the output spectrum, and weigh the rest as appropriate.