Linux has good ones, I've just never seen one as the default; if you just click through the "happy path" you'll have a crap one, and there's little guidance on which you should pick if you need to, like, actually compose text in your native human language, so the user just has to know in advance or go look up which one to select.
Mac's default, meanwhile, is (at least) nearly as good as the best Linux has, so you can start fluently typing English without having to fiddle with settings or memorize weird number sequences (sure, there's still some memorization, but much of it's simpler and closer to making sense and far more guess-able than, say, a four-digit string of numbers). Last I checked, Windows gets this wrong, too. Why either of those operating systems does that, I have no idea. That it was even incorrect didn't occur to me, somehow, until I switched to Mac and was like "why isn't the default at least this good on every platform!?"
You must have had some very bad experience with keyboard on Linux. Just curious: what was that?