If I'm not wrong, theoretically the size of every block can be up to 4 MB.
Theoretically, if the block included a single P2WSH transaction with an enormous script which took up the entirety of the block with witness data, then you could get within a few hundred bytes of the 4 MB limit (but not actually hit the 4 MB limit). In reality though, a block which is filled with SegWit transactions would be somewhere in the region of 2 to 3 MB.
OP, have a look at the last graph here:
https://jochen-hoenicke.de/queue/#1,8hJudging by the timing of your post and you waiting 3 hours, you presumably made the transaction somewhere around 12.30 UTC. Electrum gave you a fee to be confirmed within 2 blocks. A couple of things then happened:
First of all, there was a 27 minute block time, followed immediately by a 90 minute block time (between blocks 649370 and 649371).
Secondly, Bitmex dumped 4 MB of transactions in to the mempool at 13.00 UTC.
The fee Electrum gave you for a 2 block confirmation would have been accurate, provided the next two blocks were found in the average time of 10 minutes. It is impossible to predict that a 90 minute block time would hit, which led to the mempool filling up greatly and your transaction being pushed way lower.
This is not Electrum's fault - this is simply bad luck.