So in chinse, the phrase "How are you?" in pinyin is:
Why is this so?
The default pinyin in Ubuntu does have this quirk. I personally use Sun pyinyin or Intelligent pinyin.
You can get both with
sudo apt-get install ibus-libpinyin ibus-sunpinyin. Once downloaded, add those in the Settings -> Region & Language -> Input Sources
How your system handles pinyin input largely depends on the system input method. From your pictures I am unable to figure out which one you use. Is it sunpinyin?
Have you considered installing Sogou Pinyin? Sogou has no problem handling the phrases nihaoma and zheme -- I have just checked it on my system.
I have posted instructions on how to install Sogou Pinyin on an Ubuntu machine here