After some testing I found out what the problem was. A recipe has three parts: a constructor, an install and a update function. The constructor is called before all installs occur, this caused the confusion.
I had some things in the constructor that depended upon other parts. Because the constructor was called before all installs occur the code failed. After moving it to the install function, all went well.