1. If you can, when you are shopping for an Android phone, opt for a Google Experience Device whose software is vanilla Android and is managed directly by Google.
2. If you already have a phone with a crappy Android build, the best solution is installing a custom ROM like CyanogenMod. Most custom ROMs remove all the manufacturer junk and also tend to work well. When there are bugs that need fixing, the custom ROMs have release cycles that are measured in days or weeks, rather than months or years.
That said, I do realize that not everyone has the time, inclination and knowledge to fiddle with their phone's ROM.