No, this is not a good idea.
One reason is that only the minimum gain-bandwidth product is specified. You can count on it being at least that, but it could be, and probably is in any one part, somewhat higher. The net result is that frequencies above the gain-bandwidth product will have unpredictable attenuation.
Another issue is that while gain-bandwidth is a useful spec, it is only a very simplified model of what the opamp does. There are other issues, like slew rate and the difference between large signal and small signal responses.
Yet another issue is that the opamp won't magically pass all frequencies below the gain-bandwidth product. Generally you want to stay 10x below it to be able to ignore it. The 2 MHz signal is only 2.5x below the gain-bandwidth product, meaning you can only count on a gain of 2.5 at that frequency. That means the simplifying assumptions of a typical feedback system are being violated. Those are based on the gain being infinite, or at least "large" (again, 10x is a common margin) compared to the closed loop gain.
If you want to pass 2 MHz and attenuate 20 MHz, get a amp that can pass the 2 MHz properly, then add a deliberate filter to attenuate the 20 MHz.
But wait, there's more. As the input frequency goes up, the opamp no longer works like a opamp at all. Feeding it signals much above the unity gain frequency can cause side effects, like intermodulation distortion, rectification, or other nasty non-linear phenomena you can't predict. So get a opamp that can properly buffer up to 2 MHz, then add a low pass filter before the opamp to attenuate the unwanted higher frequencies.