On a large rimmed baking sheet, toss the shallots with 1/3 cup of the flour; shake off any excess flour. In a large, deep skillet, heat 1 inch of oil until shimmering. Add the shallots in 2 batches and fry over moderate heat until very crisp, about 3 minutes. Using a slotted spoon, transfer to paper towels, then sprinkle with salt.
In a large pot of boiling salted water, cook the beans until just tender, about 5 minutes. Drain and refresh under cold running water; drain and pat dry.
Melt the butter in a large, enameled cast-iron casserole. Add the onion and cook over low heat, stirring occasionally, until softened, about 5 minutes. Add the paprika, cayenne and a large pinch of pepper; cook for 1 minute, stirring. Add the mushrooms, cover and cook over moderate heat until softened, about 5 minutes. Uncover and cook, stirring, until browned, about 5 minutes longer. Stir in the remaining 3 tablespoons of flour and gradually stir in the stock until smooth.
Simmer the mushroom sauce over low heat, stirring, until thickened, about 5 minutes. Stir in the crème fraîche, lemon juice and beans. Cover and simmer, stirring occasionally, until the beans are heated through, about 5 minutes. Season with salt and pepper and transfer to a large glass or ceramic baking dish.
Preheat the oven to 400°. Cover the casserole with foil and bake until bubbling, about 20 minutes. Uncover, scatter the shallots on top and serve.
Make Ahead: The assembled casserole can be refrigerated overnight. Let return to room temperature before baking. The fried shallots can be kept overnight in an airtight container. Recrisp in a 350° oven and let cool.