Well this is dumb. My code was generating the uncompressed addresses, not the proper compressed ones. m/0 is the proper derivation path for standard p2pkh addresses.
I'd still like to know what derivation path Electrum uses for segwit bech32 p2wpkh addresses.