The problem was that the custom field data of the machine post was probably not saved yet.
using add_action('save_post_machines', 'associate_machine', 10, 3);
using
add_action('acf/save_post', 'associate_machine', 11);
instead of post save
, resolved the problem.
What I had trouble finding before is that the priority should apparently be > 10.