I think a way exist but also if Charles can have exactly the same genes but he's not an Habsburg: the French royal house do not accept female inheritance in the Royal house then you need a Charles who his descendent of the male line of the French Royal House and because Charles great grandfather (Charles the Bold, duke of Burgundy) was a French prince of a junior branch of the royal house, then you need a gender swap between Charles grandparents. So you have the son of Charles the Bold who marry the first daughter of Emperor Fredrick III and became himself Holy Roman Emperor at his father-in-law's death, then marry his son Philip to Joanna of Castile and their son Charles inherit all their territories (Burgundy, Austria, Castile and Aragon) and in the same period the main line of the Valois and also both the lines of Valois-Orleans and Valois Aungouleme of the French royal house became extinct (if others branches are senior than the Burgundy line also them became exctincts) and Charles being the next in line became King of France