It seems as if Rashi is eluding to the Messiah, "son of David" and not David himself in the Micah commentary. "from you shall emerge for Me: the Messiah, son of David..."

Then in the Psalm 118:22 commentary he states:
"The stone that the builders rejected: A people that was humble among the peoples."

Now he seems to be eluding to Israel as the rejected stone and not David or the Messiah.

This is perplexing.