When did David Hamelech become the fourth leg of the Merkavah?
The Sefer Rekanti Al Hatorah (toward the end of *Parshas Noach) cites the Zohar Chadash (P. Lech-Lecha) stating that
David Hamelech joined the Avos, Avraham, Yitzchak, and Yaakov, as the fourth leg of the Merkavha (the Divine Charriot of Hashem) only after his death, on the day which the Bais Hamikdash was built by his son Shlomo Hamelech.
The Chafetz Chaim in his Shmiras Halashon part 1 Shaar Hatevunah 8:3 States:
כְּמוֹ שֶׁמָּצִינוּ (שְׁמוּאֵל ב' ט"ז) אֵצֶל דָּוִד הַמֶּלֶךְ עָלָיו הַשָּׁלוֹם, בְּשָׁעָה שֶׁקִּלֵּל אוֹתוֹ שִׁמְעִי בֶּן גֵּרָא וְעִפֵּר אוֹתוֹ בְּעָפָר, וְרָצוּ עַבְדֵי דָּוִד לְקַנְאוֹת לִכְבוֹדוֹ עֲבוּר זֶה, לֹא הִנִּיחַ לָהֶם וְקִבֵּל עַל עַצְמוֹ הַדִּין בְּאָמְרוֹ (שָׁם י'), "ה' אָמַר לוֹ קַלֵּל", וְאָמְרוּ רַזַ"ל, שֶׁבְּאוֹתוֹ שָׁעָה זָכָה דָּוִד לִהְיוֹת הָרְבִיעִי לְרַגְלֵי מֶרְכָּבָה:
As we find with King David, may peace be upon him (II Samuel 16:7), when Shimi ben Gera cursed him and cast stones upon him and the servants of David wanted to be zealous for his honor because of this. He did not allow them to do so and accepted the din upon himself, saying (Ibid. 10): "The L-rd has told him to curse," concerning which Chazal have said: "At that time David merited becoming the fourth of the legs of the Divine Chariot."
This is also found in the Sefer Shevet Mussar 20:19
How can we reconcile these seemingly contradictory sources, as to when David Hamelech became the fourth leg of the Merkavah?
[Suggestion: Maybe we can explain that which the Chafetz Chaim says ""At that time David merited becoming the fourth of the legs of the Divine Chariot" to mean that at that time he merited to later become the fourth leg of the Divine Chariot. In actuality, (for some yet to be explained reason), this merit did not come to actual fruition until after his death, when his son Shlomo built the Bais Hamikdash. - (This seems to me to be a bit of "tweak" to the words of the Chafetz Chaim.)]