[FIXED JENKINS-22778] Revert JENKINS-18574 related changes

See discussion at ec606ac7557772cb07e72f00c084203810ebd815 and [JENKINS-22778](https://issues.jenkins-ci.org/browse/JENKINS-22778) for a description why these commits need to be reverted.