If data is being generated by the engine and then input into a shader, then yes, the shader and the engine need to agree upon the layout of that data.
For a simple object, this might be some standard cbuffer that just contains a 'world' matrix - this is basically the objects 'render transform component'. For an animated object it might be a cbuffer containing an array of bone matrices.
You might have another standardized cbuffer that contains the view-proj matrix that's owned by the camera, etc.
Not every cbuffer layout needs to be standardized like this, just ones that contain data that's generated by the engine, like matrices.
Often material settings (colours, texture scales, etc) can be set just once, by looking up a variables location within a cbuffer by name. In my engine, I build these kinds of material cbuffers offline using a tool (which reads the values from an artist's DAE file, and matches them up with the cbuffer layout written in the shader code), but you can also do this at runtime when necessary.