Semi-custom (aka console) chips kept them afloat, and they executed well on Ryzen while Intel made modest year-over-year improvements. Doesn't mean they weren't working on a relatively tight R&D budget, though.
Ryzen worked in part because it didn't try to be super-clever. Bulldozer was very opinionated about how computing would look (cheap cpu + big coprocessor) whereas Zen is much more practical