This introduces `BakeState` and `BakeStateRef` to replace the use of `Map<int, BakeItem pointer>` in various places.