I found out a solution to the problem of overwrite block values in the original provider. It is necessary to use two additional QgsRasterDataProvider methods: 'setEditable' and 'writeBlock'. However, following code (with only two additional lines including above methods) modify original raster as expected resulting raster and written raster has the values of ...
Tested with QGIS 3.6.1
As mentioned in the documentation, you can create a label and insert this code to get the current scale for the map with the item name Map 0:
map_get( item_variables('Map 0'), 'map_scale')