If bitcoin transactions are irreversible, why some platforms (online wallets, exchanges, etc) need X confirmations to "validate" a transaction?
Saying that "a bitcoin transaction is irreversible" is a simplification. A transaction is not reversible in ordinary circumstances, but...
Without getting into too much technical detail, a transaction can possibly be canceled before the first confirmation by simultaneously making another transaction that spends the same bitcoins (so-called "double-spending"). If the competing double-spend transaction is the one that is added to a block, then the original is canceled (and thus reversed).
It is possible for a block in the block chain to be replaced by another block. There is about a 1.5% chance of that happening to a newly added block. So, even if the original transaction is added to a block in the block chain, there is a small chance that the block is replaced by a diiferent block that may contain the competing double-spend transaction, which would cancel the original transaction.
The permanence of a block depends on the number of blocks that follow it, so waiting for a certain number of blocks (typically 1, 3, or 6) reduces the chances of becoming the victim of a double-spend.