You are required to comply with Y's license if and when you're doing something that copyright law doesn't permit by default. In particular, Open Source licenses usually trigger when you distribute or modify the software in any form (and in some more niche scenarios).
It doesn't seem like the X source code is a derivative of the Y software. You're not distributing the Y software in any part or form. Then, Y's license doesn't matter for the X source code.
However, Y's license would become relevant if you vendor Y's code (include it as part of the X source tree), or if you provide compiled versions that include Y in full or in part.
Even if Y's license is relevant, that doesn't mean that X has to use that same license. For “permissive” Open Source licenses, attribution is typically all that's required. For example, you might include a document that lists all third party components and their copyright and license notices. In case of MIT/ISC keeping the notices around for the recipient is pretty much all that's required, but other licenses might have more complex conditions.
A useful mental model is not that X includes Y, but that you're creating software that includes the X and Y components. The combination of these components might have one overall license, but usually there's going to be a patchwork of licenses for the various components. Those licenses do have to be compatible with each other, but permissive licenses are highly compatible – they don't even require the software as a whole to be Open Source.