I'm drawing marker line with user defined geometry of the marker (see example on the picture). Markers are placed with interval of screen (not map) units. It's possible to do with svg-marker or font marker. Can't find way to do it with geometry generator. Symbols on the picture are for example. I have a lot of user defined symbols, exported from other GIS. Most of them are not so easy to draw.
Though not your desired solution, your can use two marker lines in order to recreate the pattern. Use both rectangle-marker and line-marker in the same size, offset the linemarker so it is in the middle of the rectangle and voilá.
If this does not suit your needs, please edit your question accordingly.