Fix issue where bake was missing habtm associations

If the current model is not the first table, habtm associations would be
missed. This was caused by eff4004261a2bd05e4df54ee2af057c680ff50fc

Refs #3532
Fixes #3605