“That reminds me,” said Harry after a while. “Can we test my hypothesis about how to use a Patronus to send messages?” [...]
The trick—or so Harry hypothesized—was wanting to spread the good news, wanting the recipient to know the truth of whatever happy thought you’d used to cast the Patronus Charm. Only instead of telling the recipient in words, the Patronus itself was the message. By wanting them to see that, the Patronus would go to them.
He just came up with the idea independently.
Or at least he saw that it could be done and independently came up with how.