Dr. Dean: "Playing the privates game." That's so cute.
You did exactly the right thing. You say, "We don't do this in public," and just send him to his room. Don't slap him or make a big deal about it. In time, his fascination will disappear. The bigger the deal parents make over it, the more kids do it.
I have never seen this be a sign of a serious problem. Sometimes a lesion is irritating the child, but that doesn't sound like this situation.
Touching just feels good, so at this age both boys and girls will hump and rub themselves.
Even fetuses show sexual activity. I have a wonderful article on female fetuses "masturbating" - that is what it actually says - to what some researchers propose is the point of orgasm.
Keep on handling this lightly, and he will lose interest.