I simply think the OP is unrealistic regarding Houston's ability to sign Melo outright. They simply don't have the cap room to offer Melo his max.
Let's assume the cap is $63.2 million.
Currently Houston has the following amount in guaranteed salaries for next year (I'm including Chandler Parson because it makes no sense for them not to pick up his option). I'll exclude Lin and Asik, because they're supposedly traded to get cap room.
Dwight Howard - $21,436,271
James Harden - $14,728,844
Terrence Jones - $1,618,680
Donatas Motiejunas - $1,483,920
Chandler Parsons - $964,750
Isaiah Canaan - $816,482
Robert Covington - $150,000 (partially guaranteed that amount)
That totals to $41,198,947. It's also only 6 players (since Covington is presumably waived). However, there are a couple more salaries to think about:
Francisco Garcia - $1,316,809 (player option)
Patrick Beverly - $915,243 (unguaranteed)
Garcia has a player option, and his accepting it is outside of their control. To be truthful, I don't know if he will or won't, but it's something that must be considered. Beverley is non-guaranteed, but has been a big part of their team, and is not getting released in a world where Jeremy Lin is traded.
When you add the above two into the Rockets, they're now at $43,430,999, with 8 players. Furthermore, they would have three cap hold at $507,336 each, bringing their salary and cap holds $44,953,007. With a cap of $63.2 million, this leaves approximately $18.2 million in cap room for Melo. Melo's max deal can pay him just shy of $22.5 million. That's a gap they can't close very well.
Even if you suppose that they get rid of Beverly and Garcia wants out, that's still two more cap holds (for a total of five) of $507,336 added to the $41,198,947 number from earlier, bringing them to $43,735,627, which is better, but still restricts them from offering Melo more than $19.5 million, $3 million less than his max.
Now suppose instead that they trade off their entire roster except for Harden and Howard. No more Parsons, Jones, Motiejunas -- they're all gone. That leaves them with $36,165,115 committed to those two, plus 9 cap holds of $507,336, for a total of $40.731,139. Assuming the cap is $63.2 million to the penny, this leaves them with $22,468,861 cap room, barely $10k more than Melo's max salary of $22,458,402.
It seems unfathomable to me that they would shed off their entire team for Melo, so I just don't see him being signed via cap room.
Of course, that doesn't mean Melo won't show up in Houston. But doing so would require a sign-and-trade with New York. Boston can certainly be part of that deal, but paying New York to play along is going to cost something, maybe something significant, and some of that cost may come from Boston. It's not as simple as sending us Asik and Lin, and even another salary, to create room, unless Melo is willing to leave a lot on the table.