He definitely had plans to marry Joanna of Portugal. Any foreign princess would have made sense, really, because she secured for him a heady political alliance.
EoY would have brought him the advantage of uniting Richard and the Woodvilles. Tudor could also not lay any claim to her that way, and neither could any other man who held designs on the throne. There was, after all, only one Yorkist heiress in all England (excluding her sisters, of course), and it was Elizabeth of York. Margaret of Warwick was certainly another, but the daughter of a former king holds more obvious power than the daughter of a prince or duke.
As for the law that declared her a bastard? Even if it were the law, do you think she was treated as a bastard by her contemporaries, that is, on a regular basis? She had been a princess her whole life. A law does not necessarily change the mindset of the people who saw her, received her, interacted with her. Titulus Regius was conceived for the purpose of putting aside Edward IV's sons and giving Richard way to the throne. The princes in the tower were likely dead, and if not that, dead in name and by practical terms anyway. His marriage with Elizabeth of York would have united the House of York and given him the heirs he so desperately needed after the death of his son, Edward, Prince of Wales.
The people seeing him wed the sister of Edward V and Richard, Duke of York could have also steered them away from the notion that Richard III was responsible for the young princes' deaths. Elizabeth of York would have been attracted to the option because, naturally, she would have been queen. She would have the opportunity to exit the sanctuary she had spent the recent years of her life in and be honored at court. It was her natural home, having been born and bred a princess.
A foreign alliance would have been likelier still, but Richard also had the challenge of uniting England. His own house of York was tragically, fatally divided, and to salvage that he may have considered marrying his greatest enemy's niece, the daughter of a Woodville. Of all the internal headaches he had, it would have been one less if he had only to deal with his traditional enemy, Lancaster, and not the fervently ambitious Woodville clan.