Absolutely no problem. You can very easily handle this with a custom uninstall. Just check from the custom uninstall for "X" if the Product GUID for Program "Y" is still there and then display a "Before removing X, please uninstall Y first." message -or- offer to automatically uninstall "Y" first from the "X" custom uninstall.
Friedrich