Ok I had to make another change to increment the cacheId of the Texture in my own class RenderTarget : (And put this into the sf namespace)
namespace sf
{
static sf::Uint64 getUniqueId()
{
static sf::Uint64 id = 1; // start at 1, zero is "no texture"
static sf::Mutex mutex;
sf::Lock lock(mutex);
return id++;
}
Otherwise it doesn't increment the m_cacheId.