relay-core: rework parsing callback system to make it a lot more generic