To be honest, your tank is way too small for all those fish. It is just big enough for the betta. Neons and harlequins need a tank at least 60 cm long, with bigger being better.
This would not have caused the problem with the harlequins directly but it will cause problems for them.
Firstly the small size will stress the neons and harlequins, and stressed fish get sick easier.
secondly, with so many fish in such a small tank you probably have water quality issues. What are the levels of ammonia, nitrite and nitrate in the tank? Any level of ammonia and nitrite is harmful to fish, and a nitrate level of over 20 ppm is also harmful. Please let us know those levels, either from your own test kit or take a sample to a fish shop and ask them to test for those three - and get the numbers not something vague like OK or bit high. You don't mention how you cycled the tank (ie grown the beneficial bacteria needed to remove the ammonia made by the fish, and the nitriate made from that) so you may still have ammonia and nitrite in the water. And with that many fish, nitrate will build up quickly unless you do large water changes at least once a week.
It would also be useful to know how hard your water is. This information should be somewhere on your water provider's website - again we need a number, and the unit, rather than some vague words. If you can't find it, a fish shop can test a sample of your tap water for GH and KH (the two types of hardness)
When you say change the pump do you mean the filter? If you change that you need to move all the media (the stuff inside the filter) into the new one. The good bacteria that have grown in the filter in the last month or so must be kept for the sake of the fish, and using the old media is the way to do that.
Going forwards, you need to either return the harlequins and neons, or get a bigger tank and move the harlequins and neons into that. We can help you set up a bigger tank so that you don't put the fish through a fish-in cycle.
Your current 22 litre tank is fine for the betta, but they are not community fish and should be kept alone. The shrimps may or may not survive with a betta long term.