Many of the smokeboxes we refer to today as "extended" are how the engines came out of the builder's shops. They were originally designed to contain screen and baffles which would reduce cinder fires, and possibly improve efficiency in other ways.
The D&RGW C-21's were among some engines modified by shortening the smokeboxes. As an example, CB&Q 537 is often referred to as having an extended smokebox. Actually, 537's smokebox was identical to the original Baldwin design which was used on the C-21's out of the erection shops.
In other cases, I believe some smokeboxes were extended to allow installation of internal spark arrestors, which replaced a variety of spark arrestors contained in different types of Balloon, Diamond, Pancake, Congdon, etc. stacks as they were replaced with straight stacks.
Mike