"Well-formed" is a concept that only makes sense in XML. In rough terms, it means that every element has an explicit start tag and an explicit end tag and they they are in the right places. It has nothing to do with the content of the Doctype declaration.
The latest version of the HTML specification says:
A DOCTYPE must consist of the following components, in this order:
- A string that is an ASCII case-insensitive match for the string "
- One or more space characters.
- A string that is an ASCII case-insensitive match for the string "html".
- Optionally, a DOCTYPE legacy string or an obsolete permitted DOCTYPE string (defined below).
- Zero or more space characters.
- A ">" (U+003E) character.
… so the change your deployment tool is making is neither "well-formed" nor in any way correct.
Breaking the Doctype in that way triggers Quirks Mode. This makes browsers backwards compatible with the browsers of the late 1990s by emulating many of the bugs they featured.
The CSS is breaking because it depends on those bugs not being present.
You could probably rewrite all the CSS so it is designed to work in Quirks Mode, but fixing the deployment tool so it doesn't break the Doctype would be better.