I actually discovered something today. Components have a boolean “Is Editor Only” property. If it is set to true, it will be excluded from cooked builds. This does exactly what we want (at least for components).
Can we see the same for actors as well?