Yes, rainbow fish really need hard water to thrive, like the mollies.
Unlike the mollies, rainbow fish also need to be kept in larger groups, 6 plus of the same species of rainbow fish, which also means a much larger tank than 16g for the larger species like the ones OP has.
OP, it sounds as though you likely have soft water. API also has a test kit for GH and KH, and hopefully the store can test those numbers for you so we can suggest more suitable species. There are far more species suited to soft water than hard, and plenty of nano species that could thrive in your size tank (I have two tanks that size myself).
But hard water species are not going to thrive in soft water, and it does look a lot like shimmies in those poor mollies...