>>32423164The games are almost totally self-contained in terms of story. Apart from small bits of lore and references the plot of the other games don't get mentioned at all (apart from gen 2 which was a direct sequel to RBY).
I recommend Moon only if you want a recent game to transfer stuff forward to (the only reason I played SM, as I like to keep up with the series in the vague hope one of the future games will actually be worth my time).
As for an actual good Pokémon game after gen 4? Black and White. B2W2 had a shittier story than BW, and most of the added features are wifi related and therefore are irrelevant now that DS wifi is dead. But BW are decent games with a decent story and lots of postgame, with the added benefit of letting you transfer up anything you have in Gen 4 to Pokémon Bank.
If you had to play two games in the series right now I would recommend Black and Sun. If you can only play one game I recommend Black.