Is this a bug or is this by design?
It's by design,
The simple reason according to Microsoft is that “the publishing feature creates site elements that are not supported as part of a template, and these elements remain even when the feature is disabled. This also includes templates that were created through SharePoint Designer.” Ref
Unsupported Customized permissions, running workflow instances, list item version history, workflow tasks associated with running workflows, people or group field values, taxonomy field values, publishing sites and pages, and stapled features.
Supported Lists, libraries, external lists, data source connections, list views and data views, custom forms, workflows, content types, custom actions, navigation, site pages, master pages, modules, and web templates.
For more details check,
Is the workaround as simple as turning to publish off, saving as a template, and turning to publish back on?
No, it's not a solution, The site that has ever had Publishing features enabled can’t be saved as a template. and most of all workaround will be failed,
Note: Any workaround over the internet to
‘Save site as a template‘ from a Publishing Site or from a site that has ever had publishing
features enabled is unsupported and often doesn’t work.
For more details, please Check, at Missing Save Site as a template