How to exclude plugins (or folders) from builds on some platforms?

Let’s say I’m making a game for multiple platforms. Each platform has a bunch of folders I need to download into my plugins folder in order to use features required by their platforms. The platform holders frown on having someone else’s plugins included in their build even if they’re not called, so they need to be excluded. Is there a way to tell Unity to exclude certain folders or assets from builds for certain platforms?

I know how to exclude scripts from builds using platform conditional language. Is there something similar for folders or assets that I don’t know about?

If you pack the code into a .dll, you can exclude that dll on those platforms.

If you have the code in an asmdef, you can have that asmdef be platform-specific as well.