I don't think Musk is doing it due to greed. He may or maynot be profiting with these hypes he create, but most of his tweets comes to challenge the establishment. He's a vocal supporter of crypto and decentralization. He likes to challenge the established economic system. He even spoke in favor of wallstreetbets which basically is a revolt against institutional control of free market.
If Elon Musk doesn't have greed, what would stimulate him to do such crazy things, I believe he has also taken into account situations where the community is stimulated in such a way, a brilliant investor like him is too used to reading other people's minds, the selection for dogecoin may be random and he feels this project may rise more than others. Elon Musk has always been a fan of arrogance, the companies he contributes to show his personal character, is very confident and does things differently from the average person.