[BUGFIX] Use correct available columns while setting unused elements

Set unused columns has to be moved after database operations
to make sure the correct backend layout will be used for tca items

Change-Id: I8c36b2d2c94afa38cb4452802d9545b675d513e8
Resolves: #58295
Reviewed-on: https://review.typo3.org/29882
Reviewed-by: Jo Hasenau
Tested-by: Jo Hasenau